diff --git a/apps/common/mobile/lib/controller/ContextMenu.jsx b/apps/common/mobile/lib/controller/ContextMenu.jsx index ef6f5f897..c5b580e22 100644 --- a/apps/common/mobile/lib/controller/ContextMenu.jsx +++ b/apps/common/mobile/lib/controller/ContextMenu.jsx @@ -18,6 +18,7 @@ class ContextMenuController extends Component { extraItems: [] }; + this.fastCoAuthTips = []; this.onMenuItemClick = this.onMenuItemClick.bind(this); this.onMenuClosed = this.onMenuClosed.bind(this); this.onActionClosed = this.onActionClosed.bind(this); @@ -161,9 +162,6 @@ class ContextMenuController extends Component { /** coauthoring begin **/ const tipHeight = 20; - if (!this.fastCoAuthTips) { - this.fastCoAuthTips = []; - } let src; for (let i=0; i { // MM/dd/yyyy hh:mm AM return (date.getMonth() + 1) + '/' + (date.getDate()) + '/' + date.getFullYear() + ' ' + format(date); }; +const parseUserName = name => { + return AscCommon.UserInfoParser.getParsedName(name); +}; //end utils class CommentsController extends Component { @@ -123,10 +126,14 @@ class CommentsController extends Component { ((data.asc_getTime() === '') ? new Date() : new Date(stringUtcToLocalDate(data.asc_getTime()))); let user = this.usersStore.searchUserById(data.asc_getUserId()); + const name = data.asc_getUserName(); + const parsedName = parseUserName(name); changeComment.comment = data.asc_getText(); changeComment.userId = data.asc_getUserId(); - changeComment.userName = data.asc_getUserName(); + changeComment.userName = name; + changeComment.parsedName = Common.Utils.String.htmlEncode(parsedName); + changeComment.userInitials = this.usersStore.getInitials(parsedName); changeComment.userColor = (user) ? user.asc_getColor() : null; changeComment.resolved = data.asc_getSolved(); changeComment.quote = data.asc_getQuoteText(); @@ -146,15 +153,17 @@ class CommentsController extends Component { user = this.usersStore.searchUserById(data.asc_getReply(i).asc_getUserId()); const userName = data.asc_getReply(i).asc_getUserName(); + const parsedName = parseUserName(userName); replies.push({ ind: i, userId: data.asc_getReply(i).asc_getUserId(), userName: userName, + parsedName: Common.Utils.String.htmlEncode(parsedName), userColor: (user) ? user.asc_getColor() : null, date: dateToLocaleTimeString(dateReply), reply: data.asc_getReply(i).asc_getText(), time: dateReply.getTime(), - userInitials: this.usersStore.getInitials(userName), + userInitials: this.usersStore.getInitials(parsedName), editable: this.appOptions.canEditComments || (data.asc_getReply(i).asc_getUserId() === this.curUserId), removable: this.appOptions.canDeleteComments || (data.asc_getReply(i).asc_getUserId() === this.curUserId) }); @@ -172,10 +181,12 @@ class CommentsController extends Component { const user = this.usersStore.searchUserById(data.asc_getUserId()); const groupName = id.substr(0, id.lastIndexOf('_')+1).match(/^(doc|sheet[0-9_]+)_/); const userName = data.asc_getUserName(); + const parsedName = parseUserName(userName); const comment = { uid : id, userId : data.asc_getUserId(), userName : userName, + parsedName : Common.Utils.String.htmlEncode(parsedName), userColor : (user) ? user.asc_getColor() : null, date : dateToLocaleTimeString(date), quote : data.asc_getQuoteText(), @@ -185,7 +196,7 @@ class CommentsController extends Component { time : date.getTime(), replies : [], groupName : (groupName && groupName.length>1) ? groupName[1] : null, - userInitials : this.usersStore.getInitials(userName), + userInitials : this.usersStore.getInitials(parsedName), editable : this.appOptions.canEditComments || (data.asc_getUserId() === this.curUserId), removable : this.appOptions.canDeleteComments || (data.asc_getUserId() === this.curUserId) }; @@ -208,15 +219,17 @@ class CommentsController extends Component { ((data.asc_getReply(i).asc_getTime() === '') ? new Date() : new Date(stringUtcToLocalDate(data.asc_getReply(i).asc_getTime()))); const user = this.usersStore.searchUserById(data.asc_getReply(i).asc_getUserId()); const userName = data.asc_getReply(i).asc_getUserName(); + const parsedName = parseUserName(userName); replies.push({ ind : i, userId : data.asc_getReply(i).asc_getUserId(), userName : userName, + parsedName : Common.Utils.String.htmlEncode(parsedName), userColor : (user) ? user.asc_getColor() : null, date : dateToLocaleTimeString(date), reply : data.asc_getReply(i).asc_getText(), time : date.getTime(), - userInitials : this.usersStore.getInitials(userName), + userInitials : this.usersStore.getInitials(parsedName), editable : this.appOptions.canEditComments || (data.asc_getReply(i).asc_getUserId() === this.curUserId), removable : this.appOptions.canDeleteComments || (data.asc_getReply(i).asc_getUserId() === this.curUserId) }); @@ -252,9 +265,9 @@ class AddCommentController extends Component { if (!this.currentUser) { this.currentUser = this.props.users.setCurrentUser(this.props.storeAppOptions.user.id); } - const name = this.currentUser.asc_getUserName(); + const name = parseUserName(this.currentUser.asc_getUserName()); return { - name: name, + name: Common.Utils.String.htmlEncode(name), initials: this.props.users.getInitials(name), color: this.currentUser.asc_getColor() }; @@ -296,9 +309,9 @@ class EditCommentController extends Component { } getUserInfo () { this.currentUser = this.props.users.currentUser; - const name = this.currentUser.asc_getUserName(); + const name = parseUserName(this.currentUser.asc_getUserName()); return { - name: name, + name: Common.Utils.String.htmlEncode(name), initials: this.props.users.getInitials(name), color: this.currentUser.asc_getColor() }; diff --git a/apps/common/mobile/lib/controller/collaboration/Review.jsx b/apps/common/mobile/lib/controller/collaboration/Review.jsx index d8a42eaf7..830ab10de 100644 --- a/apps/common/mobile/lib/controller/collaboration/Review.jsx +++ b/apps/common/mobile/lib/controller/collaboration/Review.jsx @@ -468,13 +468,14 @@ class ReviewChange extends Component { let change; let goto = false; if (arrChangeReview.length > 0) { + const name = AscCommon.UserInfoParser.getParsedName(arrChangeReview[0].user); change = { date: arrChangeReview[0].date, user: arrChangeReview[0].user, - userName: Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(arrChangeReview[0].user)), + userName: Common.Utils.String.htmlEncode(name), color: arrChangeReview[0].userColor.get_hex(), text: arrChangeReview[0].changeText, - initials: this.props.users.getInitials(arrChangeReview[0].user), + initials: this.props.users.getInitials(name), editable: arrChangeReview[0].editable }; goto = arrChangeReview[0].goto; diff --git a/apps/common/mobile/lib/store/comments.js b/apps/common/mobile/lib/store/comments.js index 6d5fc05cc..8163b1917 100644 --- a/apps/common/mobile/lib/store/comments.js +++ b/apps/common/mobile/lib/store/comments.js @@ -70,6 +70,8 @@ export class storeComments { comment.comment = changeComment.comment; comment.userId = changeComment.userId; comment.userName = changeComment.userName; + comment.parsedName = changeComment.parsedName; + comment.userInitials = changeComment.userInitials; comment.userColor = changeComment.userColor; comment.resolved = changeComment.resolved; comment.quote = changeComment.quote; diff --git a/apps/common/mobile/lib/store/users.js b/apps/common/mobile/lib/store/users.js index 776c6e408..b13152b94 100644 --- a/apps/common/mobile/lib/store/users.js +++ b/apps/common/mobile/lib/store/users.js @@ -52,7 +52,7 @@ export class storeUsers { } getInitials (name) { - const fio = AscCommon.UserInfoParser.getParsedName(name).split(' '); + const fio = name.split(' '); let initials = fio[0].substring(0, 1).toUpperCase(); for (let i = fio.length-1; i>0; i--) { if (fio[i][0]!=='(' && fio[i][0]!==')') { diff --git a/apps/common/mobile/lib/view/collaboration/Comments.jsx b/apps/common/mobile/lib/view/collaboration/Comments.jsx index d403f8cbb..de88658f7 100644 --- a/apps/common/mobile/lib/view/collaboration/Comments.jsx +++ b/apps/common/mobile/lib/view/collaboration/Comments.jsx @@ -223,7 +223,7 @@ const EditCommentPopup = inject("storeComments")(observer(({storeComments, comme
{comment.userInitials}
}
-
{comment.userName}
+
{comment.parsedName}
{comment.date}
@@ -260,7 +260,7 @@ const EditCommentDialog = inject("storeComments")(observer(({storeComments, comm
${Device.android ? templateInitials : ''}
-
${comment.userName}
+
${comment.parsedName}
${comment.date}
@@ -479,7 +479,7 @@ const EditReplyPopup = inject("storeComments")(observer(({storeComments, comment
{reply.userInitials}
}
-
{reply.userName}
+
{reply.parsedName}
{reply.date}
@@ -516,7 +516,7 @@ const EditReplyDialog = inject("storeComments")(observer(({storeComments, commen
${Device.android ? templateInitials : ''}
-
${reply.userName}
+
${reply.parsedName}
${reply.date}
@@ -663,7 +663,7 @@ const ViewComments = ({storeComments, storeAppOptions, onCommentMenuClick, onRes
{isAndroid &&
{comment.userInitials}
}
-
{comment.userName}
+
{comment.parsedName}
{comment.date}
@@ -693,7 +693,7 @@ const ViewComments = ({storeComments, storeAppOptions, onCommentMenuClick, onRes
{isAndroid &&
{reply.userInitials}
}
-
{reply.userName}
+
{reply.parsedName}
{reply.date}
@@ -792,7 +792,7 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
{isAndroid &&
{comment.userInitials}
}
-
{comment.userName}
+
{comment.parsedName}
{comment.date}
@@ -822,7 +822,7 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
{isAndroid &&
{reply.userInitials}
}
-
{reply.userName}
+
{reply.parsedName}
{reply.date}