Comments refactoring

This commit is contained in:
Julia Radzhabova 2021-07-06 23:24:44 +03:00
parent 79dbe85bdf
commit 0bcce8991c
5 changed files with 10 additions and 4 deletions

View file

@ -1374,6 +1374,7 @@ define([
date: this.dateToLocaleTimeString(date), date: this.dateToLocaleTimeString(date),
userid: this.currentUserId, userid: this.currentUserId,
username: AscCommon.UserInfoParser.getCurrentName(), username: AscCommon.UserInfoParser.getCurrentName(),
parsedName: AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName()),
usercolor: (user) ? user.get('color') : null, usercolor: (user) ? user.get('color') : null,
editTextInPopover: true, editTextInPopover: true,
showReplyInPopover: false, showReplyInPopover: false,

View file

@ -56,6 +56,7 @@ define([
guid : '', guid : '',
userid : 0, userid : 0,
username : 'Guest', username : 'Guest',
parsedName : 'Guest',
usercolor : null, usercolor : null,
date : undefined, date : undefined,
quote : '', quote : '',
@ -88,6 +89,7 @@ define([
time : 0, // acs time : 0, // acs
userid : 0, userid : 0,
username : 'Guest', username : 'Guest',
parsedName : 'Guest',
usercolor : null, usercolor : null,
reply : '', reply : '',
date : undefined, date : undefined,

View file

@ -4,7 +4,7 @@
<!-- comment block --> <!-- comment block -->
<div class="user-name"> <div class="user-name">
<div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(username) %> <div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(parsedName) %>
</div> </div>
<div class="user-date"><%=date%></div> <div class="user-date"><%=date%></div>
<% if (quote!==null && quote!=='') { %> <% if (quote!==null && quote!=='') { %>
@ -31,7 +31,7 @@
<% } %> <% } %>
<div class="reply-item-ct" <% if (scope.viewmode && index==replys.length-1) { %>style="padding-bottom: 0;" <% } %>;> <div class="reply-item-ct" <% if (scope.viewmode && index==replys.length-1) { %>style="padding-bottom: 0;" <% } %>;>
<div class="user-name"> <div class="user-name">
<div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(item.get("username")) %> <div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(item.get("parsedName")) %>
</div> </div>
<div class="user-date"><%=item.get("date")%></div> <div class="user-date"><%=item.get("date")%></div>
<% if (!item.get("editText")) { %> <% if (!item.get("editText")) { %>

View file

@ -4,7 +4,7 @@
<!-- comment block --> <!-- comment block -->
<div class="user-name"> <div class="user-name">
<div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(username) %> <div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(parsedName) %>
</div> </div>
<div class="user-date"><%=date%></div> <div class="user-date"><%=date%></div>
<% if (!editTextInPopover || hint) { %> <% if (!editTextInPopover || hint) { %>
@ -32,7 +32,7 @@
<% } %> <% } %>
<div class="reply-item-ct"> <div class="reply-item-ct">
<div class="user-name"> <div class="user-name">
<div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(item.get("username")) %> <div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(item.get("parsedName")) %>
</div> </div>
<div class="user-date"><%=item.get("date")%></div> <div class="user-date"><%=item.get("date")%></div>
<% if (!item.get("editTextInPopover")) { %> <% if (!item.get("editTextInPopover")) { %>

View file

@ -697,6 +697,9 @@ define([
getUserName: function (username) { getUserName: function (username) {
return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username)); return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username));
}, },
getEncodedName: function (username) {
return Common.Utils.String.htmlEncode(username);
},
pickLink: function (message) { pickLink: function (message) {
var arr = [], offset, len; var arr = [], offset, len;