Merge pull request #22121 from owncloud/comments-deleteduser
Special label for deleted users in comments list
This commit is contained in:
commit
899444103a
|
@ -44,7 +44,7 @@
|
||||||
'<li class="comment{{#if isUnread}} unread{{/if}}" data-id="{{id}}">' +
|
'<li class="comment{{#if isUnread}} unread{{/if}}" data-id="{{id}}">' +
|
||||||
' <div class="authorRow">' +
|
' <div class="authorRow">' +
|
||||||
' {{#if avatarEnabled}}' +
|
' {{#if avatarEnabled}}' +
|
||||||
' <div class="avatar" data-username="{{actorId}}"> </div>' +
|
' <div class="avatar" {{#if actorId}}data-username="{{actorId}}"{{/if}}> </div>' +
|
||||||
' {{/if}}' +
|
' {{/if}}' +
|
||||||
' <div class="author">{{actorDisplayName}}</div>' +
|
' <div class="author">{{actorDisplayName}}</div>' +
|
||||||
'{{#if isUserAuthor}}' +
|
'{{#if isUserAuthor}}' +
|
||||||
|
@ -115,11 +115,20 @@
|
||||||
if (!this._commentTemplate) {
|
if (!this._commentTemplate) {
|
||||||
this._commentTemplate = Handlebars.compile(COMMENT_TEMPLATE);
|
this._commentTemplate = Handlebars.compile(COMMENT_TEMPLATE);
|
||||||
}
|
}
|
||||||
return this._commentTemplate(_.extend({
|
|
||||||
|
params = _.extend({
|
||||||
avatarEnabled: this._avatarsEnabled,
|
avatarEnabled: this._avatarsEnabled,
|
||||||
editTooltip: t('comments', 'Edit comment'),
|
editTooltip: t('comments', 'Edit comment'),
|
||||||
isUserAuthor: OC.getCurrentUser().uid === params.actorId
|
isUserAuthor: OC.getCurrentUser().uid === params.actorId
|
||||||
}, params));
|
}, params);
|
||||||
|
|
||||||
|
if (params.actorType === 'deleted_users') {
|
||||||
|
// makes the avatar a X
|
||||||
|
params.actorId = null;
|
||||||
|
params.actorDisplayName = t('comments', '[Deleted user]');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._commentTemplate(params);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLabel: function() {
|
getLabel: function() {
|
||||||
|
@ -149,7 +158,9 @@
|
||||||
this.$el.find('.comments').before(this.editCommentTemplate({}));
|
this.$el.find('.comments').before(this.editCommentTemplate({}));
|
||||||
this.$el.find('.has-tooltip').tooltip();
|
this.$el.find('.has-tooltip').tooltip();
|
||||||
this.$container = this.$el.find('ul.comments');
|
this.$container = this.$el.find('ul.comments');
|
||||||
this.$el.find('.avatar').avatar(OC.getCurrentUser().uid, 28);
|
if (this._avatarsEnabled) {
|
||||||
|
this.$el.find('.avatar').avatar(OC.getCurrentUser().uid, 28);
|
||||||
|
}
|
||||||
this.delegateEvents();
|
this.delegateEvents();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,6 @@ describe('OCA.Comments.CommentsTabView tests', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders comments', function() {
|
it('renders comments', function() {
|
||||||
|
|
||||||
view.setFileInfo(fileInfoModel);
|
view.setFileInfo(fileInfoModel);
|
||||||
view.collection.set(testComments);
|
view.collection.set(testComments);
|
||||||
|
|
||||||
|
@ -100,6 +99,15 @@ describe('OCA.Comments.CommentsTabView tests', function() {
|
||||||
expect($item.find('.date').text()).toEqual('5 minutes ago');
|
expect($item.find('.date').text()).toEqual('5 minutes ago');
|
||||||
expect($item.find('.message').html()).toEqual('Second<br>Newline');
|
expect($item.find('.message').html()).toEqual('Second<br>Newline');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders comments from deleted user differently', function() {
|
||||||
|
testComments[0].set('actorType', 'deleted_users', {silent: true});
|
||||||
|
view.collection.set(testComments);
|
||||||
|
|
||||||
|
var $item = view.$el.find('.comment[data-id=1]');
|
||||||
|
expect($item.find('.author').text()).toEqual('[Deleted user]');
|
||||||
|
expect($item.find('.avatar').attr('data-username')).not.toBeDefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('more comments', function() {
|
describe('more comments', function() {
|
||||||
var hasMoreResultsStub;
|
var hasMoreResultsStub;
|
||||||
|
|
Loading…
Reference in New Issue