Fix Bug 35504.

This commit is contained in:
Julia Radzhabova 2017-08-04 11:18:37 +03:00
parent 8a64cc883e
commit 0a3b92e1ef

View file

@ -177,6 +177,7 @@ define([
comment.asc_putText(commentVal); comment.asc_putText(commentVal);
comment.asc_putTime(this.utcDateToString(new Date())); comment.asc_putTime(this.utcDateToString(new Date()));
comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date()));
comment.asc_putUserId(this.currentUserId); comment.asc_putUserId(this.currentUserId);
comment.asc_putUserName(this.currentUserName); comment.asc_putUserName(this.currentUserName);
comment.asc_putSolved(false); comment.asc_putSolved(false);
@ -212,6 +213,7 @@ define([
ascComment.asc_putText(comment.get('comment')); ascComment.asc_putText(comment.get('comment'));
ascComment.asc_putQuoteText(comment.get('quote')); ascComment.asc_putQuoteText(comment.get('quote'));
ascComment.asc_putTime(t.utcDateToString(new Date(comment.get('time')))); ascComment.asc_putTime(t.utcDateToString(new Date(comment.get('time'))));
ascComment.asc_putOnlyOfficeTime(t.ooDateToString(new Date(comment.get('time'))));
ascComment.asc_putUserId(comment.get('userid')); ascComment.asc_putUserId(comment.get('userid'));
ascComment.asc_putUserName(comment.get('username')); ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(!comment.get('resolved')); ascComment.asc_putSolved(!comment.get('resolved'));
@ -227,6 +229,7 @@ define([
if (addReply) { if (addReply) {
addReply.asc_putText(reply.get('reply')); addReply.asc_putText(reply.get('reply'));
addReply.asc_putTime(t.utcDateToString(new Date(reply.get('time')))); addReply.asc_putTime(t.utcDateToString(new Date(reply.get('time'))));
addReply.asc_putOnlyOfficeTime(t.ooDateToString(new Date(reply.get('time'))));
addReply.asc_putUserId(reply.get('userid')); addReply.asc_putUserId(reply.get('userid'));
addReply.asc_putUserName(reply.get('username')); addReply.asc_putUserName(reply.get('username'));
@ -300,6 +303,7 @@ define([
ascComment.asc_putText(commentVal); ascComment.asc_putText(commentVal);
ascComment.asc_putQuoteText(comment.get('quote')); ascComment.asc_putQuoteText(comment.get('quote'));
ascComment.asc_putTime(t.utcDateToString(new Date(comment.get('time')))); ascComment.asc_putTime(t.utcDateToString(new Date(comment.get('time'))));
ascComment.asc_putOnlyOfficeTime(t.ooDateToString(new Date(comment.get('time'))));
ascComment.asc_putUserId(t.currentUserId); ascComment.asc_putUserId(t.currentUserId);
ascComment.asc_putUserName(t.currentUserName); ascComment.asc_putUserName(t.currentUserName);
ascComment.asc_putSolved(comment.get('resolved')); ascComment.asc_putSolved(comment.get('resolved'));
@ -326,6 +330,7 @@ define([
if (addReply) { if (addReply) {
addReply.asc_putText(reply.get('reply')); addReply.asc_putText(reply.get('reply'));
addReply.asc_putTime(t.utcDateToString(new Date(reply.get('time')))); addReply.asc_putTime(t.utcDateToString(new Date(reply.get('time'))));
addReply.asc_putOnlyOfficeTime(t.ooDateToString(new Date(reply.get('time'))));
addReply.asc_putUserId(reply.get('userid')); addReply.asc_putUserId(reply.get('userid'));
addReply.asc_putUserName(reply.get('username')); addReply.asc_putUserName(reply.get('username'));
@ -354,6 +359,7 @@ define([
ascComment.asc_putText(comment.get('comment')); ascComment.asc_putText(comment.get('comment'));
ascComment.asc_putQuoteText(comment.get('quote')); ascComment.asc_putQuoteText(comment.get('quote'));
ascComment.asc_putTime(me.utcDateToString(new Date(comment.get('time')))); ascComment.asc_putTime(me.utcDateToString(new Date(comment.get('time'))));
ascComment.asc_putOnlyOfficeTime(me.ooDateToString(new Date(comment.get('time'))));
ascComment.asc_putUserId(comment.get('userid')); ascComment.asc_putUserId(comment.get('userid'));
ascComment.asc_putUserName(comment.get('username')); ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(comment.get('resolved')); ascComment.asc_putSolved(comment.get('resolved'));
@ -379,6 +385,7 @@ define([
} }
addReply.asc_putTime(me.utcDateToString(new Date(reply.get('time')))); addReply.asc_putTime(me.utcDateToString(new Date(reply.get('time'))));
addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date(reply.get('time'))));
ascComment.asc_addReply(addReply); ascComment.asc_addReply(addReply);
} }
@ -414,6 +421,7 @@ define([
ascComment.asc_putText(comment.get('comment')); ascComment.asc_putText(comment.get('comment'));
ascComment.asc_putQuoteText(comment.get('quote')); ascComment.asc_putQuoteText(comment.get('quote'));
ascComment.asc_putTime(me.utcDateToString(new Date(comment.get('time')))); ascComment.asc_putTime(me.utcDateToString(new Date(comment.get('time'))));
ascComment.asc_putOnlyOfficeTime(me.ooDateToString(new Date(comment.get('time'))));
ascComment.asc_putUserId(comment.get('userid')); ascComment.asc_putUserId(comment.get('userid'));
ascComment.asc_putUserName(comment.get('username')); ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(comment.get('resolved')); ascComment.asc_putSolved(comment.get('resolved'));
@ -430,6 +438,7 @@ define([
if (addReply) { if (addReply) {
addReply.asc_putText(reply.get('reply')); addReply.asc_putText(reply.get('reply'));
addReply.asc_putTime(me.utcDateToString(new Date(reply.get('time')))); addReply.asc_putTime(me.utcDateToString(new Date(reply.get('time'))));
addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date(reply.get('time'))));
addReply.asc_putUserId(reply.get('userid')); addReply.asc_putUserId(reply.get('userid'));
addReply.asc_putUserName(reply.get('username')); addReply.asc_putUserName(reply.get('username'));
@ -442,6 +451,7 @@ define([
if (addReply) { if (addReply) {
addReply.asc_putText(replyVal); addReply.asc_putText(replyVal);
addReply.asc_putTime(me.utcDateToString(new Date())); addReply.asc_putTime(me.utcDateToString(new Date()));
addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date()));
addReply.asc_putUserId(me.currentUserId); addReply.asc_putUserId(me.currentUserId);
addReply.asc_putUserName(me.currentUserName); addReply.asc_putUserName(me.currentUserName);
@ -468,6 +478,7 @@ define([
ascComment.asc_putText(comment.get('comment')); ascComment.asc_putText(comment.get('comment'));
ascComment.asc_putQuoteText(comment.get('quote')); ascComment.asc_putQuoteText(comment.get('quote'));
ascComment.asc_putTime(me.utcDateToString(new Date(comment.get('time')))); ascComment.asc_putTime(me.utcDateToString(new Date(comment.get('time'))));
ascComment.asc_putOnlyOfficeTime(me.ooDateToString(new Date(comment.get('time'))));
ascComment.asc_putUserId(comment.get('userid')); ascComment.asc_putUserId(comment.get('userid'));
ascComment.asc_putUserName(comment.get('username')); ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(comment.get('resolved')); ascComment.asc_putSolved(comment.get('resolved'));
@ -484,6 +495,7 @@ define([
if (addReply) { if (addReply) {
addReply.asc_putText(reply.get('reply')); addReply.asc_putText(reply.get('reply'));
addReply.asc_putTime(me.utcDateToString(new Date(reply.get('time')))); addReply.asc_putTime(me.utcDateToString(new Date(reply.get('time'))));
addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date(reply.get('time'))));
addReply.asc_putUserId(reply.get('userid')); addReply.asc_putUserId(reply.get('userid'));
addReply.asc_putUserName(reply.get('username')); addReply.asc_putUserName(reply.get('username'));
@ -666,8 +678,8 @@ define([
if (comment) { if (comment) {
t = this; t = this;
date = (data.asc_getTime() == '') ? date = (data.asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getOnlyOfficeTime())) :
new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime())); ((data.asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime())));
comment.set('comment', data.asc_getText()); comment.set('comment', data.asc_getText());
comment.set('userid', data.asc_getUserId()); comment.set('userid', data.asc_getUserId());
@ -684,8 +696,8 @@ define([
repliesCount = data.asc_getRepliesCount(); repliesCount = data.asc_getRepliesCount();
for (i = 0; i < repliesCount; ++i) { for (i = 0; i < repliesCount; ++i) {
dateReply = (data.asc_getReply(i).asc_getTime() == '') ? dateReply = (data.asc_getReply(i).asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getReply(i).asc_getOnlyOfficeTime())) :
new Date() : new Date(this.stringUtcToLocalDate(data.asc_getReply(i).asc_getTime())); ((data.asc_getReply(i).asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getReply(i).asc_getTime())));
replies.push(new Common.Models.Reply({ replies.push(new Common.Models.Reply({
id : Common.UI.getId(), id : Common.UI.getId(),
@ -1030,7 +1042,8 @@ define([
// helpers // helpers
readSDKComment: function (id, data) { readSDKComment: function (id, data) {
var date = (data.asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime())); var date = (data.asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getOnlyOfficeTime())) :
((data.asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime())));
var comment = new Common.Models.Comment({ var comment = new Common.Models.Comment({
uid : id, uid : id,
userid : data.asc_getUserId(), userid : data.asc_getUserId(),
@ -1067,8 +1080,8 @@ define([
var repliesCount = data.asc_getRepliesCount(); var repliesCount = data.asc_getRepliesCount();
if (repliesCount) { if (repliesCount) {
for (i = 0; i < repliesCount; ++i) { for (i = 0; i < repliesCount; ++i) {
date = (data.asc_getReply(i).asc_getTime() == '') ? date = (data.asc_getReply(i).asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getReply(i).asc_getOnlyOfficeTime())) :
new Date() : new Date(this.stringUtcToLocalDate(data.asc_getReply(i).asc_getTime())); ((data.asc_getReply(i).asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getReply(i).asc_getTime())));
replies.push(new Common.Models.Reply({ replies.push(new Common.Models.Reply({
id : Common.UI.getId(), id : Common.UI.getId(),
@ -1169,6 +1182,7 @@ define([
} }
comment.asc_putText(commentVal); comment.asc_putText(commentVal);
comment.asc_putTime(this.utcDateToString(new Date())); comment.asc_putTime(this.utcDateToString(new Date()));
comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date()));
comment.asc_putUserId(this.currentUserId); comment.asc_putUserId(this.currentUserId);
comment.asc_putUserName(this.currentUserName); comment.asc_putUserName(this.currentUserName);
comment.asc_putSolved(false); comment.asc_putSolved(false);
@ -1275,6 +1289,19 @@ define([
timeZoneOffsetInMs: (new Date()).getTimezoneOffset() * 60000, timeZoneOffsetInMs: (new Date()).getTimezoneOffset() * 60000,
stringOOToLocalDate: function (date) {
if (typeof date === 'string')
return parseInt(date);
return 0;
},
ooDateToString: function (date) {
if (Object.prototype.toString.call(date) === '[object Date]')
return (date.getTime()).toString();
return '';
},
stringUtcToLocalDate: function (date) { stringUtcToLocalDate: function (date) {
if (typeof date === 'string') if (typeof date === 'string')
return parseInt(date) + this.timeZoneOffsetInMs; return parseInt(date) + this.timeZoneOffsetInMs;