Skip to content

Commit

Permalink
Fix user image in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Oct 12, 2023
1 parent b34aa48 commit a6e2f51
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions apps/common/main/lib/controller/Comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ define([
comment.set('parsedName', AscCommon.UserInfoParser.getParsedName(data.asc_getUserName()));
comment.set('parsedGroups', AscCommon.UserInfoParser.getParsedGroups(data.asc_getUserName()));
comment.set('usercolor', (user) ? user.get('color') : null);
comment.set('avatar', (user) ? user.get('avatar') : null);
comment.set('avatar', avatar);
comment.set('resolved', data.asc_getSolved());
comment.set('quote', data.asc_getQuoteText());
comment.set('userdata', data.asc_getUserData());
Expand Down Expand Up @@ -1301,15 +1301,16 @@ define([
hasGroup = false,
updateCommentData = function(comment, user, isNotReply) {
var color = (user) ? user.get('color') : null,
avatar = (user) ? user.get('avatar') : null,
needrender = false;
if (color !== comment.get('usercolor')) {
needrender = true;
comment.set('usercolor', color, {silent: true});
}
if (avatar !== comment.get('avatar')) {
needrender = true;
comment.set('avatar', avatar, {silent: true});
if (user && user.image) {
if (user.image !== comment.get('avatar')) {
needrender = true;
comment.set('avatar', user.image, {silent: true});
}
}

//If a comment and not a reply
Expand Down Expand Up @@ -1426,7 +1427,7 @@ define([
var filter = !!group && (group!==-1) && (!usergroups || usergroups.length<1 || usergroups.indexOf(group)<0);
comment.set('filtered', filter);
}
var replies = this.readSDKReplies(data);
var replies = this.readSDKReplies(data, requestObj);
if (replies.length) {
comment.set('replys', replies);
}
Expand All @@ -1448,7 +1449,7 @@ define([
var userid = data.asc_getReply(i).asc_getUserId(),
user = this.userCollection.findOriginalUser(userid),
avatar = Common.UI.ExternalUsers.getImage(userid);
(avatar===undefined) && requestObj.arrIds.push(userid);
(avatar===undefined) && requestObj && requestObj.arrIds.push(userid);
replies.push(new Common.Models.Reply({
id : Common.UI.getId(),
userid : userid,
Expand Down

0 comments on commit a6e2f51

Please sign in to comment.