|
|
@ -1452,8 +1452,8 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
function wrapForHistory (photoID, options) { |
|
|
|
function wrapForHistory (photoID, options) { |
|
|
|
options = options || {}; |
|
|
|
options = options || {}; |
|
|
|
var photo = angular.copy(photos[photoID]) || {_: 'photoEmpty'}, |
|
|
|
var photo = angular.copy(photos[photoID]) || {_: 'photoEmpty'}, |
|
|
|
width = options.website ? 100 : Math.min(windowW - 80, Config.Mobile ? 210 : 260), |
|
|
|
width = options.website ? 64 : Math.min(windowW - 80, Config.Mobile ? 210 : 260), |
|
|
|
height = options.website ? 100 : Math.min(windowH - 100, Config.Mobile ? 210 : 260), |
|
|
|
height = options.website ? 64 : Math.min(windowH - 100, Config.Mobile ? 210 : 260), |
|
|
|
thumbPhotoSize = choosePhotoSize(photo, width, height), |
|
|
|
thumbPhotoSize = choosePhotoSize(photo, width, height), |
|
|
|
thumb = { |
|
|
|
thumb = { |
|
|
|
placeholder: 'img/placeholders/PhotoThumbConversation.gif', |
|
|
|
placeholder: 'img/placeholders/PhotoThumbConversation.gif', |
|
|
@ -1626,24 +1626,38 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
delete apiWebPage.document; |
|
|
|
delete apiWebPage.document; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
apiWebPage.rTitle = RichTextProcessor.wrapRichText( |
|
|
|
var siteName = apiWebPage.site_name; |
|
|
|
apiWebPage.title || apiWebPage.author, |
|
|
|
var title = apiWebPage.title || apiWebPage.author || siteName; |
|
|
|
{noLinks: true, noLinebreaks: true} |
|
|
|
if (siteName && |
|
|
|
); |
|
|
|
title == siteName) { |
|
|
|
|
|
|
|
delete apiWebPage.site_name; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
apiWebPage.rTitle = RichTextProcessor.wrapRichText(title, {noLinks: true, noLinebreaks: true}); |
|
|
|
var contextHashtag = ''; |
|
|
|
var contextHashtag = ''; |
|
|
|
if (apiWebPage.site_name == 'GitHub') { |
|
|
|
if (siteName == 'GitHub') { |
|
|
|
var matches = apiWebPage.url.match(/(https?:\/\/github\.com\/[^\/]+\/[^\/]+)/); |
|
|
|
var matches = apiWebPage.url.match(/(https?:\/\/github\.com\/[^\/]+\/[^\/]+)/); |
|
|
|
if (matches) { |
|
|
|
if (matches) { |
|
|
|
contextHashtag = matches[0] + '/issues/{1}'; |
|
|
|
contextHashtag = matches[0] + '/issues/{1}'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// delete apiWebPage.description;
|
|
|
|
apiWebPage.rDescription = RichTextProcessor.wrapRichText( |
|
|
|
apiWebPage.rDescription = RichTextProcessor.wrapRichText( |
|
|
|
apiWebPage.description, { |
|
|
|
apiWebPage.description, { |
|
|
|
contextSite: apiWebPage.site_name || 'external', |
|
|
|
contextSite: siteName || 'external', |
|
|
|
contextHashtag: contextHashtag |
|
|
|
contextHashtag: contextHashtag |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (apiWebPage.type != 'photo' && |
|
|
|
|
|
|
|
apiWebPage.type != 'video' && |
|
|
|
|
|
|
|
apiWebPage.type != 'gif' && |
|
|
|
|
|
|
|
apiWebPage.type != 'document' && |
|
|
|
|
|
|
|
apiWebPage.type != 'gif' && |
|
|
|
|
|
|
|
!apiWebPage.description && |
|
|
|
|
|
|
|
apiWebPage.photo) { |
|
|
|
|
|
|
|
apiWebPage.type = 'photo'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (messageID) { |
|
|
|
if (messageID) { |
|
|
|
if (pendingWebPages[apiWebPage.id] === undefined) { |
|
|
|
if (pendingWebPages[apiWebPage.id] === undefined) { |
|
|
|
pendingWebPages[apiWebPage.id] = {}; |
|
|
|
pendingWebPages[apiWebPage.id] = {}; |
|
|
@ -2966,6 +2980,19 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var curState = channelID ? getChannelState(channelID, update.pts) : updatesState; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(dT(), 'process', channelID, curState.pts, update);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (curState.syncLoading) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (update._ == 'updateChannelTooLong') { |
|
|
|
|
|
|
|
getChannelDifference(channelID); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (update._ == 'updateNewMessage' || |
|
|
|
if (update._ == 'updateNewMessage' || |
|
|
|
update._ == 'updateEditMessage' || |
|
|
|
update._ == 'updateEditMessage' || |
|
|
|
update._ == 'updateNewChannelMessage' || |
|
|
|
update._ == 'updateNewChannelMessage' || |
|
|
@ -2978,7 +3005,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
fwdHeader.channel_id && !AppChatsManager.hasChat(fwdHeader.channel_id) || |
|
|
|
fwdHeader.channel_id && !AppChatsManager.hasChat(fwdHeader.channel_id) || |
|
|
|
toPeerID > 0 && !AppUsersManager.hasUser(toPeerID) || |
|
|
|
toPeerID > 0 && !AppUsersManager.hasUser(toPeerID) || |
|
|
|
toPeerID < 0 && !AppChatsManager.hasChat(-toPeerID)) { |
|
|
|
toPeerID < 0 && !AppChatsManager.hasChat(-toPeerID)) { |
|
|
|
console.warn(dT(), 'Short update not enough data', message); |
|
|
|
console.warn(dT(), 'Not enough data for message update', message); |
|
|
|
if (channelID && AppChatsManager.hasChat(channelID)) { |
|
|
|
if (channelID && AppChatsManager.hasChat(channelID)) { |
|
|
|
getChannelDifference(channelID); |
|
|
|
getChannelDifference(channelID); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -2987,23 +3014,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if (channelID && !AppChatsManager.hasChat(channelID)) { |
|
|
|
if (channelID && !AppChatsManager.hasChat(channelID)) { |
|
|
|
|
|
|
|
// console.log(dT(), 'skip update, missing channel', channelID, update);
|
|
|
|
// console.log(dT(), 'skip update, missing channel', channelID, update);
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
var curState = channelID ? getChannelState(channelID, update.pts) : updatesState; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(dT(), 'process', channelID, curState.pts, update); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (curState.syncLoading) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (update._ == 'updateChannelTooLong') { |
|
|
|
|
|
|
|
getChannelDifference(channelID); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var popPts, popSeq; |
|
|
|
var popPts, popSeq; |
|
|
|
|
|
|
|
|
|
|
|