From 0bcce8991cba6a54e70990cd0882a77727828672 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 6 Jul 2021 23:24:44 +0300 Subject: [PATCH] Comments refactoring --- apps/common/main/lib/controller/Comments.js | 1 + apps/common/main/lib/model/Comment.js | 2 ++ apps/common/main/lib/template/Comments.template | 4 ++-- apps/common/main/lib/template/CommentsPopover.template | 4 ++-- apps/common/main/lib/view/Comments.js | 3 +++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index 21e1638f7..89cba715a 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -1374,6 +1374,7 @@ define([ date: this.dateToLocaleTimeString(date), userid: this.currentUserId, username: AscCommon.UserInfoParser.getCurrentName(), + parsedName: AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName()), usercolor: (user) ? user.get('color') : null, editTextInPopover: true, showReplyInPopover: false, diff --git a/apps/common/main/lib/model/Comment.js b/apps/common/main/lib/model/Comment.js index e58713cfd..1192e2bce 100644 --- a/apps/common/main/lib/model/Comment.js +++ b/apps/common/main/lib/model/Comment.js @@ -56,6 +56,7 @@ define([ guid : '', userid : 0, username : 'Guest', + parsedName : 'Guest', usercolor : null, date : undefined, quote : '', @@ -88,6 +89,7 @@ define([ time : 0, // acs userid : 0, username : 'Guest', + parsedName : 'Guest', usercolor : null, reply : '', date : undefined, diff --git a/apps/common/main/lib/template/Comments.template b/apps/common/main/lib/template/Comments.template index 4d587d722..d106dc70d 100644 --- a/apps/common/main/lib/template/Comments.template +++ b/apps/common/main/lib/template/Comments.template @@ -4,7 +4,7 @@
-
<%= scope.getUserName(username) %> +
<%= scope.getEncodedName(parsedName) %>
<%=date%>
<% if (quote!==null && quote!=='') { %> @@ -31,7 +31,7 @@ <% } %>
style="padding-bottom: 0;" <% } %>;>
-
<%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
<%= scope.getUserName(item.get("username")) %> +
<%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
<%= scope.getEncodedName(item.get("parsedName")) %>
<%=item.get("date")%>
<% if (!item.get("editText")) { %> diff --git a/apps/common/main/lib/template/CommentsPopover.template b/apps/common/main/lib/template/CommentsPopover.template index 5f4c5911d..f7cfc1e66 100644 --- a/apps/common/main/lib/template/CommentsPopover.template +++ b/apps/common/main/lib/template/CommentsPopover.template @@ -4,7 +4,7 @@
-
<%= scope.getUserName(username) %> +
<%= scope.getEncodedName(parsedName) %>
<%=date%>
<% if (!editTextInPopover || hint) { %> @@ -32,7 +32,7 @@ <% } %>
-
<%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
<%= scope.getUserName(item.get("username")) %> +
<%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
<%= scope.getEncodedName(item.get("parsedName")) %>
<%=item.get("date")%>
<% if (!item.get("editTextInPopover")) { %> diff --git a/apps/common/main/lib/view/Comments.js b/apps/common/main/lib/view/Comments.js index 749a655f5..9fa388ad2 100644 --- a/apps/common/main/lib/view/Comments.js +++ b/apps/common/main/lib/view/Comments.js @@ -697,6 +697,9 @@ define([ getUserName: function (username) { return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); }, + getEncodedName: function (username) { + return Common.Utils.String.htmlEncode(username); + }, pickLink: function (message) { var arr = [], offset, len;