@ -23,9 +23,7 @@
var EDIT _COMMENT _TEMPLATE =
'<div class="newCommentRow comment" data-id="{{id}}">' +
' <div class="authorRow">' +
' {{#if avatarEnabled}}' +
' <div class="avatar" data-username="{{actorId}}"></div>' +
' {{/if}}' +
' <div class="author">{{actorDisplayName}}</div>' +
'{{#if isEditMode}}' +
' <a href="#" class="action delete icon icon-delete has-tooltip" title="{{deleteTooltip}}"></a>' +
@ -44,9 +42,7 @@
var COMMENT _TEMPLATE =
'<li class="comment{{#if isUnread}} unread{{/if}}{{#if isLong}} collapsed{{/if}}" data-id="{{id}}">' +
' <div class="authorRow">' +
' {{#if avatarEnabled}}' +
' <div class="avatar" {{#if actorId}}data-username="{{actorId}}"{{/if}}> </div>' +
' {{/if}}' +
' <div class="author">{{actorDisplayName}}</div>' +
'{{#if isUserAuthor}}' +
' <a href="#" class="action edit icon icon-rename has-tooltip" title="{{editTooltip}}"></a>' +
@ -85,8 +81,6 @@
this . collection . on ( 'sync' , this . _onEndRequest , this ) ;
this . collection . on ( 'add' , this . _onAddModel , this ) ;
this . _avatarsEnabled = ! ! OC . config . enable _avatars ;
this . _commentMaxThreshold = this . _commentMaxLength * 0.9 ;
// TODO: error handling
@ -99,7 +93,6 @@
}
var currentUser = OC . getCurrentUser ( ) ;
return this . _template ( _ . extend ( {
avatarEnabled : this . _avatarsEnabled ,
actorId : currentUser . uid ,
actorDisplayName : currentUser . displayName
} , params ) ) ;
@ -111,7 +104,6 @@
}
var currentUser = OC . getCurrentUser ( ) ;
return this . _editCommentTemplate ( _ . extend ( {
avatarEnabled : this . _avatarsEnabled ,
actorId : currentUser . uid ,
actorDisplayName : currentUser . displayName ,
newMessagePlaceholder : t ( 'comments' , 'New comment …' ) ,
@ -127,7 +119,6 @@
}
params = _ . extend ( {
avatarEnabled : this . _avatarsEnabled ,
editTooltip : t ( 'comments' , 'Edit comment' ) ,
isUserAuthor : OC . getCurrentUser ( ) . uid === params . actorId ,
isLong : this . _isLong ( params . message )
@ -169,9 +160,7 @@
this . $el . find ( '.comments' ) . before ( this . editCommentTemplate ( { } ) ) ;
this . $el . find ( '.has-tooltip' ) . tooltip ( ) ;
this . $container = this . $el . find ( 'ul.comments' ) ;
if ( this . _avatarsEnabled ) {
this . $el . find ( '.avatar' ) . avatar ( OC . getCurrentUser ( ) . uid , 32 ) ;
}
this . $el . find ( '.avatar' ) . avatar ( OC . getCurrentUser ( ) . uid , 32 ) ;
this . delegateEvents ( ) ;
this . $el . find ( '.message' ) . on ( 'keydown input change' , this . _onTypeComment ) ;
@ -239,12 +228,10 @@
_postRenderItem : function ( $el ) {
$el . find ( '.has-tooltip' ) . tooltip ( ) ;
if ( this . _avatarsEnabled ) {
$el . find ( '.avatar' ) . each ( function ( ) {
var $this = $ ( this ) ;
$this . avatar ( $this . attr ( 'data-username' ) , 32 ) ;
} ) ;
}
$el . find ( '.avatar' ) . each ( function ( ) {
var $this = $ ( this ) ;
$this . avatar ( $this . attr ( 'data-username' ) , 32 ) ;
} ) ;
} ,
/ * *
@ -257,13 +244,10 @@
for ( var i in mentions ) {
var mention = '@' + mentions [ i ] . mentionId ;
var avatar = '' ;
if ( this . _avatarsEnabled ) {
avatar = '<div class="avatar" '
+ 'data-user="' + _ . escape ( mentions [ i ] . mentionId ) + '"'
+ ' data-user-display-name="'
+ _ . escape ( mentions [ i ] . mentionDisplayName ) + '"></div>' ;
}
var avatar = '<div class="avatar" '
+ 'data-user="' + _ . escape ( mentions [ i ] . mentionId ) + '"'
+ ' data-user-display-name="'
+ _ . escape ( mentions [ i ] . mentionDisplayName ) + '"></div>' ;
// escape possible regex characters in the name
mention = mention . replace ( /[.*+?^${}()|[\]\\]/g , '\\$&' ) ;