Commit 9f4a5ce2 authored by Julia Radzhabova's avatar Julia Radzhabova

Fix Bug 35504.

parent 6d6b5718
...@@ -176,6 +176,7 @@ define([ ...@@ -176,6 +176,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);
...@@ -211,6 +212,7 @@ define([ ...@@ -211,6 +212,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'));
...@@ -226,6 +228,7 @@ define([ ...@@ -226,6 +228,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'));
...@@ -299,6 +302,7 @@ define([ ...@@ -299,6 +302,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'));
...@@ -325,6 +329,7 @@ define([ ...@@ -325,6 +329,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'));
...@@ -353,6 +358,7 @@ define([ ...@@ -353,6 +358,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'));
...@@ -378,6 +384,7 @@ define([ ...@@ -378,6 +384,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);
} }
...@@ -413,6 +420,7 @@ define([ ...@@ -413,6 +420,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'));
...@@ -429,6 +437,7 @@ define([ ...@@ -429,6 +437,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'));
...@@ -441,6 +450,7 @@ define([ ...@@ -441,6 +450,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);
...@@ -467,6 +477,7 @@ define([ ...@@ -467,6 +477,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'));
...@@ -483,6 +494,7 @@ define([ ...@@ -483,6 +494,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'));
...@@ -661,8 +673,8 @@ define([ ...@@ -661,8 +673,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());
...@@ -679,8 +691,8 @@ define([ ...@@ -679,8 +691,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(),
...@@ -1025,7 +1037,8 @@ define([ ...@@ -1025,7 +1037,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(),
...@@ -1062,8 +1075,8 @@ define([ ...@@ -1062,8 +1075,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(),
...@@ -1164,6 +1177,7 @@ define([ ...@@ -1164,6 +1177,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);
...@@ -1270,6 +1284,19 @@ define([ ...@@ -1270,6 +1284,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment