Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
eab463fd
Commit
eab463fd
authored
10 years ago
by
Emmanuel ROHEE
Browse files
Options
Downloads
Patches
Plain Diff
Show notifications only when the user is detected as idle
parent
47fb2861
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webclient/room/room-controller.js
+9
-10
9 additions, 10 deletions
webclient/room/room-controller.js
with
9 additions
and
10 deletions
webclient/room/room-controller.js
+
9
−
10
View file @
eab463fd
...
@@ -15,8 +15,8 @@ limitations under the License.
...
@@ -15,8 +15,8 @@ limitations under the License.
*/
*/
angular
.
module
(
'
RoomController
'
,
[
'
ngSanitize
'
,
'
mFileInput
'
])
angular
.
module
(
'
RoomController
'
,
[
'
ngSanitize
'
,
'
mFileInput
'
])
.
controller
(
'
RoomController
'
,
[
'
$scope
'
,
'
$timeout
'
,
'
$routeParams
'
,
'
$location
'
,
'
$rootScope
'
,
'
matrixService
'
,
'
eventHandlerService
'
,
'
mFileUpload
'
,
'
matrixPhoneService
'
,
'
MatrixCall
'
,
.
controller
(
'
RoomController
'
,
[
'
$scope
'
,
'
$timeout
'
,
'
$routeParams
'
,
'
$location
'
,
'
$rootScope
'
,
'
matrixService
'
,
'
eventHandlerService
'
,
'
mFileUpload
'
,
'
mPresence
'
,
'
matrixPhoneService
'
,
'
MatrixCall
'
,
function
(
$scope
,
$timeout
,
$routeParams
,
$location
,
$rootScope
,
matrixService
,
eventHandlerService
,
mFileUpload
,
matrixPhoneService
,
MatrixCall
)
{
function
(
$scope
,
$timeout
,
$routeParams
,
$location
,
$rootScope
,
matrixService
,
eventHandlerService
,
mFileUpload
,
mPresence
,
matrixPhoneService
,
MatrixCall
)
{
'
use strict
'
;
'
use strict
'
;
var
MESSAGES_PER_PAGINATION
=
30
;
var
MESSAGES_PER_PAGINATION
=
30
;
var
THUMBNAIL_SIZE
=
320
;
var
THUMBNAIL_SIZE
=
320
;
...
@@ -57,15 +57,14 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
...
@@ -57,15 +57,14 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
scrollToBottom
();
scrollToBottom
();
if
(
window
.
Notification
)
{
if
(
window
.
Notification
)
{
// FIXME: we should also notify based on a timer or other heuristics
// Show notification when the user is idle
// rather than the window being minimised
if
(
matrixService
.
presence
.
offline
===
mPresence
.
getState
())
{
if
(
document
.
hidden
)
{
var
notification
=
new
window
.
Notification
(
var
notification
=
new
window
.
Notification
(
(
$scope
.
members
[
event
.
user_id
].
displayname
||
event
.
user_id
)
+
(
$scope
.
members
[
event
.
user_id
].
displayname
||
event
.
user_id
)
+
"
(
"
+
(
$scope
.
room_alias
||
$scope
.
room_id
)
+
"
)
"
,
// FIXME: don't leak room_ids here
"
(
"
+
(
$scope
.
room_alias
||
$scope
.
room_id
)
+
"
)
"
,
// FIXME: don't leak room_ids here
{
{
"
body
"
:
event
.
content
.
body
,
"
body
"
:
event
.
content
.
body
,
"
icon
"
:
$scope
.
members
[
event
.
user_id
].
avatar_url
,
"
icon
"
:
$scope
.
members
[
event
.
user_id
].
avatar_url
});
});
$timeout
(
function
()
{
$timeout
(
function
()
{
notification
.
close
();
notification
.
close
();
...
@@ -230,7 +229,7 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
...
@@ -230,7 +229,7 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
var
member
=
$scope
.
members
[
target_user_id
];
var
member
=
$scope
.
members
[
target_user_id
];
member
.
content
.
membership
=
chunk
.
content
.
membership
;
member
.
content
.
membership
=
chunk
.
content
.
membership
;
}
}
}
}
;
var
updatePresence
=
function
(
chunk
)
{
var
updatePresence
=
function
(
chunk
)
{
if
(
!
(
chunk
.
content
.
user_id
in
$scope
.
members
))
{
if
(
!
(
chunk
.
content
.
user_id
in
$scope
.
members
))
{
...
@@ -257,10 +256,10 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
...
@@ -257,10 +256,10 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
if
(
"
avatar_url
"
in
chunk
.
content
)
{
if
(
"
avatar_url
"
in
chunk
.
content
)
{
member
.
avatar_url
=
chunk
.
content
.
avatar_url
;
member
.
avatar_url
=
chunk
.
content
.
avatar_url
;
}
}
}
}
;
$scope
.
send
=
function
()
{
$scope
.
send
=
function
()
{
if
(
$scope
.
textInput
==
""
)
{
if
(
$scope
.
textInput
==
=
""
)
{
return
;
return
;
}
}
...
@@ -269,7 +268,7 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
...
@@ -269,7 +268,7 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
// Send the text message
// Send the text message
var
promise
;
var
promise
;
// FIXME: handle other commands too
// FIXME: handle other commands too
if
(
$scope
.
textInput
.
indexOf
(
"
/me
"
)
==
0
)
{
if
(
$scope
.
textInput
.
indexOf
(
"
/me
"
)
==
=
0
)
{
promise
=
matrixService
.
sendEmoteMessage
(
$scope
.
room_id
,
$scope
.
textInput
.
substr
(
4
));
promise
=
matrixService
.
sendEmoteMessage
(
$scope
.
room_id
,
$scope
.
textInput
.
substr
(
4
));
}
}
else
{
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment