diff --git a/apps/common/mobile/lib/store/users.js b/apps/common/mobile/lib/store/users.js index ab8e3ebdb..6ca3c140d 100644 --- a/apps/common/mobile/lib/store/users.js +++ b/apps/common/mobile/lib/store/users.js @@ -11,7 +11,8 @@ export class storeUsers { connection: action, isDisconnected: observable, resetDisconnected: action, - hasEditUsers: computed + hasEditUsers: computed, + editUsers: computed }) } @@ -91,4 +92,38 @@ export class storeUsers { }); return (length >= 1); } + + get editUsers () { + const idArray = []; + const usersArray = []; + const curUserId = this.currentUser.asc_getIdOriginal(); + this.users.forEach((item) => { + const name = AscCommon.UserInfoParser.getParsedName(item.asc_getUserName()); + if((item.asc_getState() !== false) && !item.asc_getView()) { + const idOriginal = item.asc_getIdOriginal(); + const ind = idArray.indexOf(idOriginal); + if (ind !== -1) { + usersArray[ind].count = usersArray[ind].count + 1; + } else { + const userAttr = { + color: item.asc_getColor(), + id: item.asc_getId(), + idOriginal: item.asc_getIdOriginal(), + name: name, + view: item.asc_getView(), + initials: this.getInitials(name), + count: 1 + }; + if(idOriginal === curUserId) { + usersArray.unshift(userAttr); + idArray.unshift(idOriginal); + } else { + usersArray.push(userAttr); + idArray.push(idOriginal); + } + } + } + }); + return usersArray; + } } diff --git a/apps/common/mobile/lib/view/collaboration/Collaboration.jsx b/apps/common/mobile/lib/view/collaboration/Collaboration.jsx index ee7e1e739..b78c1ca6b 100644 --- a/apps/common/mobile/lib/view/collaboration/Collaboration.jsx +++ b/apps/common/mobile/lib/view/collaboration/Collaboration.jsx @@ -27,10 +27,10 @@ const PageUsers = inject("users")(observer(props => { {_t.textEditUser} - {storeUsers.users.map((model, i) => ( - -
- {storeUsers.getInitials(model.asc_getUserName())} + {storeUsers.editUsers.map((user, i) => ( + 1 ? ` (${user.count})` : '')} key={i}> +
+ {user.initials}
))}