diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-10-17 14:06:23 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-10-19 00:34:00 +0200 |
commit | 0e926efc9be2f211eb01675d3d828a93c7b5a208 (patch) | |
tree | c16825c963f879c2f958e7a6dd2aa7e9556454f3 /apps/comments/js/commentmodel.js | |
parent | 5d98ab83e9c0b69acae7dc66c5ad9a4fe4af546c (diff) | |
download | nextcloud-server-0e926efc9be2f211eb01675d3d828a93c7b5a208.tar.gz nextcloud-server-0e926efc9be2f211eb01675d3d828a93c7b5a208.zip |
show displayname not uid in commit mentions
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/comments/js/commentmodel.js')
-rw-r--r-- | apps/comments/js/commentmodel.js | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/apps/comments/js/commentmodel.js b/apps/comments/js/commentmodel.js index 89492707b61..e75c79b3f08 100644 --- a/apps/comments/js/commentmodel.js +++ b/apps/comments/js/commentmodel.js @@ -35,7 +35,8 @@ 'creationDateTime': '{' + NS_OWNCLOUD + '}creationDateTime', 'objectType': '{' + NS_OWNCLOUD + '}objectType', 'objectId': '{' + NS_OWNCLOUD + '}objectId', - 'isUnread': '{' + NS_OWNCLOUD + '}isUnread' + 'isUnread': '{' + NS_OWNCLOUD + '}isUnread', + 'mentions': '{' + NS_OWNCLOUD + '}mentions' }, parse: function(data) { @@ -48,8 +49,30 @@ creationDateTime: data.creationDateTime, objectType: data.objectType, objectId: data.objectId, - isUnread: (data.isUnread === 'true') + isUnread: (data.isUnread === 'true'), + mentions: this._parseMentions(data.mentions) }; + }, + + _parseMentions: function(mentions) { + if(_.isUndefined(mentions)) { + return {}; + } + var result = {}; + for(var i in mentions) { + var mention = mentions[i]; + if(_.isUndefined(mention.localName) || mention.localName !== 'mention') { + continue; + } + result[i] = {}; + for (var child = mention.firstChild; child; child = child.nextSibling) { + if(_.isUndefined(child.localName) || !child.localName.startsWith('mention')) { + continue; + } + result[i][child.localName] = child.textContent; + } + } + return result; } }); |