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
3983bae1
Commit
3983bae1
authored
10 years ago
by
Emmanuel ROHEE
Browse files
Options
Downloads
Patches
Plain Diff
Added mUserDisplayName, a filter to resolve a user display name from a user_id
parent
7346ea85
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webclient/components/matrix/matrix-filter.js
+33
-0
33 additions, 0 deletions
webclient/components/matrix/matrix-filter.js
webclient/recents/recents.html
+9
-9
9 additions, 9 deletions
webclient/recents/recents.html
with
42 additions
and
9 deletions
webclient/components/matrix/matrix-filter.js
+
33
−
0
View file @
3983bae1
...
...
@@ -97,4 +97,37 @@ angular.module('matrixFilter', [])
return
roomName
;
};
}])
// Compute the user display name in a room according to the data already downloaded
.
filter
(
'
mUserDisplayName
'
,
[
'
$rootScope
'
,
function
(
$rootScope
)
{
return
function
(
user_id
,
room_id
)
{
var
displayName
;
// Try to find the user name among presence data
// Warning: that means we have received before a presence event for this
// user which cannot be guaranted.
// However, if we get the info by this way, we are sure this is the latest user display name
// See FIXME comment below
if
(
user_id
in
$rootScope
.
presence
)
{
displayName
=
$rootScope
.
presence
[
user_id
].
content
.
displayname
;
}
// FIXME: Would like to use the display name as defined in room members of the room.
// But this information is the display name of the user when he has joined the room.
// It does not take into account user display name update
if
(
room_id
)
{
var
room
=
$rootScope
.
events
.
rooms
[
room_id
];
if
(
room
&&
(
user_id
in
room
.
members
))
{
var
member
=
room
.
members
[
user_id
];
displayName
=
member
.
content
.
displayname
;
}
}
if
(
undefined
===
displayName
)
{
// By default, use the user ID
displayName
=
user_id
;
}
return
displayName
;
};
}]);
This diff is collapsed.
Click to expand it.
webclient/recents/recents.html
+
9
−
9
View file @
3983bae1
...
...
@@ -19,35 +19,35 @@
<div
ng-hide=
"room.membership === 'invite'"
ng-switch=
"room.lastMsg.type"
>
<div
ng-switch-when=
"m.room.member"
>
<span
ng-if=
"'join' === room.lastMsg.content.membership"
>
{{ room.lastMsg.state_key }} joined
{{ room.lastMsg.state_key
| mUserDisplayName: room.room_id
}} joined
</span>
<span
ng-if=
"'leave' === room.lastMsg.content.membership"
>
<span
ng-if=
"room.lastMsg.user_id === room.lastMsg.state_key"
>
{{room.lastMsg.state_key }} left
{{room.lastMsg.state_key
| mUserDisplayName: room.room_id
}} left
</span>
<span
ng-if=
"room.lastMsg.user_id !== room.lastMsg.state_key"
>
{{ room.lastMsg.user_id }}
{{ room.lastMsg.user_id
| mUserDisplayName: room.room_id
}}
{{ {"join": "kicked", "ban": "unbanned"}[room.lastMsg.content.prev] }}
{{ room.lastMsg.state_key }}
{{ room.lastMsg.state_key
| mUserDisplayName: room.room_id
}}
</span>
</span>
<span
ng-if=
"'invite' === room.lastMsg.content.membership || 'ban' === room.lastMsg.content.membership"
>
{{ room.lastMsg.user_id }}
{{ room.lastMsg.user_id
| mUserDisplayName: room.room_id
}}
{{ {"invite": "invited", "ban": "banned"}[room.lastMsg.content.membership] }}
{{ room.lastMsg.state_key }}
{{ room.lastMsg.state_key
| mUserDisplayName: room.room_id
}}
</span>
</div>
<div
ng-switch-when=
"m.room.message"
>
<div
ng-switch=
"room.lastMsg.content.msgtype"
>
<div
ng-switch-when=
"m.text"
>
{{ room.lastMsg.user_id }} :
{{ room.lastMsg.user_id
| mUserDisplayName: room.room_id
}} :
<span
ng-bind-html=
"(room.lastMsg.content.body) | linky:'_blank'"
>
</span>
</div>
<div
ng-switch-when=
"m.image"
>
{{ room.lastMsg.user_id }} sent an image
{{ room.lastMsg.user_id
| mUserDisplayName: room.room_id
}} sent an image
</div>
<div
ng-switch-when=
"m.emote"
>
...
...
@@ -62,7 +62,7 @@
</div>
<div
ng-switch-default
>
<div
ng-if=
"room.lastMsg.type.indexOf('m.call.') == 0"
>
<div
ng-if=
"room.lastMsg.type.indexOf('m.call.') ==
=
0"
>
Call
</div>
</div>
...
...
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