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
95e171e1
Commit
95e171e1
authored
10 years ago
by
Kegan Dougal
Browse files
Options
Downloads
Patches
Plain Diff
Don't bing for sent messages. Handle cases where the member is unknown rather than erroring out.
parent
d7b206cc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webclient/components/matrix/event-handler-service.js
+8
-3
8 additions, 3 deletions
webclient/components/matrix/event-handler-service.js
webclient/room/room.html
+1
-1
1 addition, 1 deletion
webclient/room/room.html
with
9 additions
and
4 deletions
webclient/components/matrix/event-handler-service.js
+
8
−
3
View file @
95e171e1
...
@@ -177,7 +177,7 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
...
@@ -177,7 +177,7 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
$rootScope
.
events
.
rooms
[
event
.
room_id
].
messages
.
push
(
event
);
$rootScope
.
events
.
rooms
[
event
.
room_id
].
messages
.
push
(
event
);
}
}
if
(
window
.
Notification
)
{
if
(
window
.
Notification
&&
event
.
user_id
!=
matrixService
.
config
().
user_id
)
{
var
shouldBing
=
$rootScope
.
containsBingWord
(
event
.
content
.
body
);
var
shouldBing
=
$rootScope
.
containsBingWord
(
event
.
content
.
body
);
// TODO: Binging every message when idle doesn't make much sense. Can we use this more sensibly?
// TODO: Binging every message when idle doesn't make much sense. Can we use this more sensibly?
...
@@ -195,12 +195,17 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
...
@@ -195,12 +195,17 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
if
(
shouldBing
)
{
if
(
shouldBing
)
{
console
.
log
(
"
Displaying notification for
"
+
JSON
.
stringify
(
event
));
console
.
log
(
"
Displaying notification for
"
+
JSON
.
stringify
(
event
));
var
member
=
$rootScope
.
events
.
rooms
[
event
.
room_id
].
members
[
event
.
user_id
];
var
displayname
=
undefined
;
if
(
member
)
{
displayname
=
member
.
displayname
;
}
var
notification
=
new
window
.
Notification
(
var
notification
=
new
window
.
Notification
(
(
$rootScope
.
events
.
rooms
[
event
.
room_id
].
members
[
event
.
user_id
].
displayname
||
event
.
user_id
)
+
(
displayname
||
event
.
user_id
)
+
"
(
"
+
(
matrixService
.
getRoomIdToAliasMapping
(
event
.
room_id
)
||
event
.
room_id
)
+
"
)
"
,
// FIXME: don't leak room_ids here
"
(
"
+
(
matrixService
.
getRoomIdToAliasMapping
(
event
.
room_id
)
||
event
.
room_id
)
+
"
)
"
,
// FIXME: don't leak room_ids here
{
{
"
body
"
:
event
.
content
.
body
,
"
body
"
:
event
.
content
.
body
,
"
icon
"
:
$rootScope
.
events
.
rooms
[
event
.
room_id
].
members
[
event
.
user_id
].
avatar_url
"
icon
"
:
member
?
member
.
avatar_url
:
undefined
});
});
$timeout
(
function
()
{
$timeout
(
function
()
{
notification
.
close
();
notification
.
close
();
...
...
This diff is collapsed.
Click to expand it.
webclient/room/room.html
+
1
−
1
View file @
95e171e1
...
@@ -105,7 +105,7 @@
...
@@ -105,7 +105,7 @@
<span
ng-show=
'msg.content.msgtype === "m.text"'
<span
ng-show=
'msg.content.msgtype === "m.text"'
class=
"message"
class=
"message"
ng-class=
"containsBingWord(msg.content.body) ? msg.echo_msg_state + ' messageBing' : msg.echo_msg_state"
ng-class=
"containsBingWord(msg.content.body)
&& msg.user_id != state.user_id
? msg.echo_msg_state + ' messageBing' : msg.echo_msg_state"
ng-bind-html=
"((msg.content.msgtype === 'm.text') ? msg.content.body : '') | linky:'_blank'"
/>
ng-bind-html=
"((msg.content.msgtype === 'm.text') ? msg.content.body : '') | linky:'_blank'"
/>
<span
ng-show=
'msg.type === "m.call.invite" && msg.user_id == state.user_id'
>
Outgoing Call
</span>
<span
ng-show=
'msg.type === "m.call.invite" && msg.user_id == state.user_id'
>
Outgoing Call
</span>
...
...
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