summaryrefslogtreecommitdiffstats
path: root/core/js/share.js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-11-19 22:41:28 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-11-23 13:32:13 +0100
commit3a1d8fa45f22503ba9841d71b7ea630d400b2ae5 (patch)
treefee9f7bc44b3c8903addfa00386d394951aa55b7 /core/js/share.js
parent4247936dd6d5ea2fa60586e0f4aa4acbc7d902f1 (diff)
downloadnextcloud-server-3a1d8fa45f22503ba9841d71b7ea630d400b2ae5.tar.gz
nextcloud-server-3a1d8fa45f22503ba9841d71b7ea630d400b2ae5.zip
adjust, fix and extend tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'core/js/share.js')
-rw-r--r--core/js/share.js22
1 files changed, 9 insertions, 13 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 281c414b900..86954b2ced2 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -197,24 +197,20 @@ OC.Share = _.extend(OC.Share || {}, {
delete OC.Share.statuses[itemSource];
}
},
- _formatRegularShare: function(shareWith, shareWithDisplayName, message) {
- // display avatar of the user
- var avatar = '<span class="avatar" data-username="' + escapeHTML(shareWith) + '" title="' + message + " " + escapeHTML(shareWithDisplayName) + '"></span>';
- var hidden = '<span class="hidden-visually">' + message + ' ' + escapeHTML(shareWithDisplayName) + '</span> ';
- return avatar + hidden;
- },
/**
* Format a remote address
*
- * @param {String} remoteAddress full remote share
+ * @param {String} shareWith userid, full remote share, or whatever
+ * @param {String} shareWithDisplayName
+ * @param {String} message
* @return {String} HTML code to display
*/
- _formatRemoteShare: function(remoteAddress, message) {
- var parts = this._REMOTE_OWNER_REGEXP.exec(remoteAddress);
+ _formatRemoteShare: function(shareWith, shareWithDisplayName, message) {
+ var parts = this._REMOTE_OWNER_REGEXP.exec(shareWith);
if (!parts) {
// display avatar of the user
- var avatar = '<span class="avatar" data-username="' + escapeHTML(remoteAddress) + '" title="' + message + " " + escapeHTML(remoteAddress) + '"></span>';
- var hidden = '<span class="hidden-visually">' + message + ' ' + escapeHTML(remoteAddress) + '</span> ';
+ var avatar = '<span class="avatar" data-username="' + escapeHTML(shareWith) + '" title="' + message + " " + escapeHTML(shareWithDisplayName) + '"></span>';
+ var hidden = '<span class="hidden-visually">' + message + ' ' + escapeHTML(shareWithDisplayName) + '</span> ';
return avatar + hidden;
}
@@ -250,7 +246,7 @@ OC.Share = _.extend(OC.Share || {}, {
_formatShareList: function(recipients) {
var _parent = this;
return $.map(recipients, function(shareWithDisplayName, shareWith) {
- return _parent._formatRegularShare(shareWith, shareWithDisplayName, t('core', 'Shared with'));
+ return _parent._formatRemoteShare(shareWith, shareWithDisplayName, t('core', 'Shared with'));
});
},
/**
@@ -304,7 +300,7 @@ OC.Share = _.extend(OC.Share || {}, {
// even if reshared, only show "Shared by"
if (ownerId) {
message = t('core', 'Shared by');
- avatars = this._formatRegularShare(ownerId, owner, message);
+ avatars = this._formatRemoteShare(ownerId, owner, message);
} else if (recipients) {
avatars = this._formatShareList(recipients);
}