From 8db332d9a7386aab3982eb8f3f6733b9b1b8299c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Sun, 1 Nov 2020 14:27:08 +0300 Subject: [PATCH] [Mobile] Fix Bug 47191 --- .../mobile/lib/controller/Collaboration.js | 24 ++++++++++- .../lib/template/Collaboration.template | 2 +- .../mobile/app/controller/Main.js | 7 ++-- .../mobile/app/controller/Toolbar.js | 40 ++++++++++++++----- .../mobile/app/controller/Toolbar.js | 40 ++++++++++++++----- .../mobile/app/controller/Toolbar.js | 40 ++++++++++++++----- 6 files changed, 121 insertions(+), 32 deletions(-) diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 064f3ceef..cab5f8398 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -88,6 +88,7 @@ define([ this.api = api; this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onChangeEditUsers, this)); this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onChangeEditUsers, this)); + this.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(this.onUserConnection, this)); this.api.asc_registerCallback('asc_onAddComment', _.bind(this.onApiAddComment, this)); this.api.asc_registerCallback('asc_onAddComments', _.bind(this.onApiAddComments, this)); this.api.asc_registerCallback('asc_onChangeCommentData', _.bind(this.onApiChangeCommentData, this)); @@ -229,6 +230,13 @@ define([ me.initComments(); Common.Utils.addScrollIfNeed('.page[data-page=comments-view]', '.page[data-page=comments-view] .page-content'); } else { + var length = 0; + _.each(editUsers, function (item) { + if ((item.asc_getState()!==false) && !item.asc_getView()) + length++; + }); + (length<1) && $('#item-edit-users').hide(); + if(editor === 'DE' && !this.appConfig.canReview && !canViewReview) { $('#reviewing-settings').hide(); } @@ -241,6 +249,20 @@ define([ editUsers = users; }, + onUserConnection: function(change){ + var changed = false; + for (var uid in editUsers) { + if (undefined !== uid) { + var user = editUsers[uid]; + if (user && user.asc_getId() == change.asc_getId()) { + editUsers[uid] = change; + changed = true; + } + } + } + !changed && change && (editUsers[change.asc_getId()] = change); + }, + getUsersInfo: function() { var usersArray = []; _.each(editUsers, function(item){ @@ -250,7 +272,7 @@ define([ if (fio.length > 1) { initials += fio[fio.length - 1].substring(0, 1).toUpperCase(); } - if(!item.asc_getView()) { + if((item.asc_getState()!==false) && !item.asc_getView()) { var userAttr = { color: item.asc_getColor(), id: item.asc_getId(), diff --git a/apps/common/mobile/lib/template/Collaboration.template b/apps/common/mobile/lib/template/Collaboration.template index 8981fba35..00fe98b2e 100644 --- a/apps/common/mobile/lib/template/Collaboration.template +++ b/apps/common/mobile/lib/template/Collaboration.template @@ -11,7 +11,7 @@