Skip to content

Commit

Permalink
Load user images for version history
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Oct 11, 2023
1 parent 92a04c7 commit 1bee469
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
14 changes: 9 additions & 5 deletions apps/documenteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,8 @@ define([
this._renameDialog && this._renameDialog.close();
var versions = opts.data.history,
historyStore = this.getApplication().getCollection('Common.Collections.HistoryVersions'),
currentVersion = null;
currentVersion = null,
arrIds = [];
if (historyStore) {
var arrVersions = [], ver, version, group = -1, prev_ver = -1, arrColors = [], docIdPrev = '',
usersStore = this.getApplication().getCollection('Common.Collections.HistoryUsers'), user = null, usersCnt = 0;
Expand All @@ -714,15 +715,16 @@ define([
});
usersStore.add(user);
}

var avatar = Common.UI.ExternalUsers.getImage(version.user.id);
(avatar===undefined) && arrIds.push(version.user.id);
arrVersions.push(new Common.Models.HistoryVersion({
version: version.versionGroup,
revision: version.version,
userid : version.user.id,
username : version.user.name || this.textAnonymous,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(version.user.name || this.textAnonymous)),
avatar : undefined,
avatar : avatar,
created: version.created,
docId: version.key,
markedAsVersion: (group!==version.versionGroup),
Expand Down Expand Up @@ -765,7 +767,8 @@ define([
});
usersStore.add(user);
}

avatar = Common.UI.ExternalUsers.getImage(change.user.id);
(avatar===undefined) && arrIds.push(change.user.id);
arrVersions.push(new Common.Models.HistoryVersion({
version: version.versionGroup,
revision: version.version,
Expand All @@ -774,7 +777,7 @@ define([
username : change.user.name || this.textAnonymous,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(change.user.name || this.textAnonymous)),
avatar : undefined,
avatar : avatar,
created: change.created,
docId: version.key,
docIdPrev: docIdPrev,
Expand Down Expand Up @@ -807,6 +810,7 @@ define([
}
if (currentVersion)
this.getApplication().getController('Common.Controllers.History').onSelectRevision(null, null, currentVersion);
arrIds.length && Common.UI.ExternalUsers.get('info', arrIds);
}
}
},
Expand Down
14 changes: 9 additions & 5 deletions apps/presentationeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2611,7 +2611,8 @@ define([
this._renameDialog && this._renameDialog.close();
var versions = opts.data.history,
historyStore = this.getApplication().getCollection('Common.Collections.HistoryVersions'),
currentVersion = null;
currentVersion = null,
arrIds = [];
if (historyStore) {
var arrVersions = [], ver, version, group = -1, prev_ver = -1, arrColors = [], docIdPrev = '',
usersStore = this.getApplication().getCollection('Common.Collections.HistoryUsers'), user = null, usersCnt = 0;
Expand All @@ -2633,15 +2634,16 @@ define([
});
usersStore.add(user);
}

var avatar = Common.UI.ExternalUsers.getImage(version.user.id);
(avatar===undefined) && arrIds.push(version.user.id);
arrVersions.push(new Common.Models.HistoryVersion({
version: version.versionGroup,
revision: version.version,
userid : version.user.id,
username : version.user.name,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(version.user.name || this.textAnonymous)),
avatar : undefined,
avatar : avatar,
created: version.created,
docId: version.key,
markedAsVersion: (group!==version.versionGroup),
Expand Down Expand Up @@ -2684,7 +2686,8 @@ define([
});
usersStore.add(user);
}

avatar = Common.UI.ExternalUsers.getImage(change.user.id);
(avatar===undefined) && arrIds.push(change.user.id);
arrVersions.push(new Common.Models.HistoryVersion({
version: version.versionGroup,
revision: version.version,
Expand All @@ -2693,7 +2696,7 @@ define([
username : change.user.name,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(change.user.name || this.textAnonymous)),
avatar : undefined,
avatar : avatar,
created: change.created,
docId: version.key,
docIdPrev: docIdPrev,
Expand Down Expand Up @@ -2726,6 +2729,7 @@ define([
}
if (currentVersion)
this.getApplication().getController('Common.Controllers.History').onSelectRevision(null, null, currentVersion);
arrIds.length && Common.UI.ExternalUsers.get('info', arrIds);
}
}
},
Expand Down
14 changes: 9 additions & 5 deletions apps/spreadsheeteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3226,7 +3226,8 @@ define([
this._renameDialog && this._renameDialog.close();
var versions = opts.data.history,
historyStore = this.getApplication().getCollection('Common.Collections.HistoryVersions'),
currentVersion = null;
currentVersion = null,
arrIds = [];
if (historyStore) {
var arrVersions = [], ver, version, group = -1, prev_ver = -1, arrColors = [], docIdPrev = '',
usersStore = this.getApplication().getCollection('Common.Collections.HistoryUsers'), user = null, usersCnt = 0;
Expand All @@ -3248,15 +3249,16 @@ define([
});
usersStore.add(user);
}

var avatar = Common.UI.ExternalUsers.getImage(version.user.id);
(avatar===undefined) && arrIds.push(version.user.id);
arrVersions.push(new Common.Models.HistoryVersion({
version: version.versionGroup,
revision: version.version,
userid : version.user.id,
username : version.user.name,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(version.user.name || this.textAnonymous)),
avatar : undefined,
avatar : avatar,
created: version.created,
docId: version.key,
markedAsVersion: (group!==version.versionGroup),
Expand Down Expand Up @@ -3299,7 +3301,8 @@ define([
});
usersStore.add(user);
}

avatar = Common.UI.ExternalUsers.getImage(change.user.id);
(avatar===undefined) && arrIds.push(change.user.id);
arrVersions.push(new Common.Models.HistoryVersion({
version: version.versionGroup,
revision: version.version,
Expand All @@ -3308,7 +3311,7 @@ define([
username : change.user.name,
usercolor: user.get('color'),
initials : Common.Utils.getUserInitials(AscCommon.UserInfoParser.getParsedName(change.user.name || this.textAnonymous)),
avatar : undefined,
avatar : avatar,
created: change.created,
docId: version.key,
docIdPrev: docIdPrev,
Expand Down Expand Up @@ -3341,6 +3344,7 @@ define([
}
// if (currentVersion)
// this.getApplication().getController('Common.Controllers.History').onSelectRevision(null, null, currentVersion);
arrIds.length && Common.UI.ExternalUsers.get('info', arrIds);
}
}
},
Expand Down

0 comments on commit 1bee469

Please sign in to comment.