Shared media fixes:
Fix load end of document tab Add support for entity-check in links tab
This commit is contained in:
parent
eded39cad2
commit
d60910f533
@ -648,7 +648,7 @@ export default class AppSharedMediaTab implements SliderTab {
|
|||||||
|
|
||||||
if(!typesToLoad.length) return;
|
if(!typesToLoad.length) return;
|
||||||
|
|
||||||
const loadCount = justLoad ? 50 : (appPhotosManager.windowH / 130 | 0) * 3 * 1.25; // that's good for all types
|
const loadCount = justLoad ? 50 : Math.round((appPhotosManager.windowH / 130 | 0) * 3 * 1.25); // that's good for all types
|
||||||
|
|
||||||
const historyStorage = this.historiesStorage[peerID] ?? (this.historiesStorage[peerID] = {});
|
const historyStorage = this.historiesStorage[peerID] ?? (this.historiesStorage[peerID] = {});
|
||||||
|
|
||||||
@ -657,27 +657,29 @@ export default class AppSharedMediaTab implements SliderTab {
|
|||||||
|
|
||||||
const history = historyStorage[type] ?? (historyStorage[type] = []);
|
const history = historyStorage[type] ?? (historyStorage[type] = []);
|
||||||
|
|
||||||
const logStr = `loadSidebarMedia [${type}]: `;
|
const logStr = 'loadSidebarMedia [' + type + ']: ';
|
||||||
|
|
||||||
// render from cache
|
// render from cache
|
||||||
if(history.length && this.usedFromHistory[type] < history.length && !justLoad) {
|
if(history.length && this.usedFromHistory[type] < history.length && !justLoad) {
|
||||||
let messages: any[] = [];
|
let messages: any[] = [];
|
||||||
let used = Math.max(0, this.usedFromHistory[type]);
|
let used = Math.max(0, this.usedFromHistory[type]);
|
||||||
|
let slicedLength = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let ids = history.slice(used, used + loadCount);
|
let ids = history.slice(used, used + loadCount);
|
||||||
this.log(logStr + 'will render from cache', used, history, ids, loadCount);
|
this.log(logStr + 'will render from cache', used, history, ids, loadCount);
|
||||||
used += ids.length;
|
used += ids.length;
|
||||||
|
slicedLength += ids.length;
|
||||||
|
|
||||||
messages.push(...this.filterMessagesByType(ids, type));
|
messages.push(...this.filterMessagesByType(ids, type));
|
||||||
} while(messages.length < loadCount && used < history.length);
|
} while(slicedLength < loadCount && used < history.length);
|
||||||
|
|
||||||
// если перебор
|
// если перебор
|
||||||
if(messages.length > loadCount) {
|
/* if(slicedLength > loadCount) {
|
||||||
let diff = messages.length - loadCount;
|
let diff = messages.length - loadCount;
|
||||||
messages = messages.slice(0, messages.length - diff);
|
messages = messages.slice(0, messages.length - diff);
|
||||||
used -= diff;
|
used -= diff;
|
||||||
}
|
} */
|
||||||
|
|
||||||
this.usedFromHistory[type] = used;
|
this.usedFromHistory[type] = used;
|
||||||
//if(messages.length) {
|
//if(messages.length) {
|
||||||
@ -704,7 +706,9 @@ export default class AppSharedMediaTab implements SliderTab {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(history.length >= value.count) {
|
// ! Фикс случая, когда не загружаются документы при открытой панели разработчиков (происходит из-за того, что не совпадают критерии отбора документов в getSearch)
|
||||||
|
if(value.history.length < loadCount) {
|
||||||
|
//if((value.count || history.length == value.count) && history.length >= value.count) {
|
||||||
this.log(logStr + 'loaded all media', value, loadCount);
|
this.log(logStr + 'loaded all media', value, loadCount);
|
||||||
this.loadedAllMedia[type] = true;
|
this.loadedAllMedia[type] = true;
|
||||||
}
|
}
|
||||||
|
@ -3039,7 +3039,7 @@ export class AppMessagesManager {
|
|||||||
var neededContents: {
|
var neededContents: {
|
||||||
[messageMediaType: string]: boolean
|
[messageMediaType: string]: boolean
|
||||||
} = {},
|
} = {},
|
||||||
neededDocTypes: string[] = [];
|
neededDocTypes: string[] = [], excludeDocTypes: string[] = [];
|
||||||
|
|
||||||
switch(inputFilter._) {
|
switch(inputFilter._) {
|
||||||
case 'inputMessagesFilterPhotos':
|
case 'inputMessagesFilterPhotos':
|
||||||
@ -3059,6 +3059,7 @@ export class AppMessagesManager {
|
|||||||
|
|
||||||
case 'inputMessagesFilterDocument':
|
case 'inputMessagesFilterDocument':
|
||||||
neededContents['messageMediaDocument'] = true;
|
neededContents['messageMediaDocument'] = true;
|
||||||
|
excludeDocTypes.push('video');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'inputMessagesFilterVoice':
|
case 'inputMessagesFilterVoice':
|
||||||
@ -3107,16 +3108,20 @@ export class AppMessagesManager {
|
|||||||
//|| (neededContents['mentioned'] && message.totalEntities.find((e: any) => e._ == 'messageEntityMention'));
|
//|| (neededContents['mentioned'] && message.totalEntities.find((e: any) => e._ == 'messageEntityMention'));
|
||||||
|
|
||||||
let found = false;
|
let found = false;
|
||||||
if(message.media && neededContents[message.media._]) {
|
if(message.media && neededContents[message.media._] && !message.fwd_from) {
|
||||||
if(neededDocTypes.length &&
|
if(message.media._ == 'messageMediaDocument') {
|
||||||
message.media._ == 'messageMediaDocument' &&
|
if((neededDocTypes.length && !neededDocTypes.includes(message.media.document.type))
|
||||||
!neededDocTypes.includes(message.media.document.type)) {
|
|| excludeDocTypes.includes(message.media.document.type)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
} else if(neededContents['url'] && message.message && RichTextProcessor.matchUrl(message.message)) {
|
} else if(neededContents['url'] && message.message) {
|
||||||
found = true;
|
const goodEntities = ['messageEntityTextUrl', 'messageEntityUrl'];
|
||||||
|
if((message.totalEntities as MessageEntity[]).find(e => goodEntities.includes(e._)) || RichTextProcessor.matchUrl(message.message)) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
} else if(neededContents['avatar'] && message.action && ['messageActionChannelEditPhoto', 'messageActionChatEditPhoto'].includes(message.action._)) {
|
} else if(neededContents['avatar'] && message.action && ['messageActionChannelEditPhoto', 'messageActionChatEditPhoto'].includes(message.action._)) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
@ -1682,6 +1682,7 @@ poll-element {
|
|||||||
display: block;
|
display: block;
|
||||||
//min-width: 280px;
|
//min-width: 280px;
|
||||||
min-width: 330px;
|
min-width: 330px;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
@include respond-to(handhelds) {
|
@include respond-to(handhelds) {
|
||||||
min-width: 240px;
|
min-width: 240px;
|
||||||
@ -1694,7 +1695,6 @@ poll-element {
|
|||||||
.poll {
|
.poll {
|
||||||
&-title {
|
&-title {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
user-select: none;
|
|
||||||
|
|
||||||
@include respond-to(handhelds) {
|
@include respond-to(handhelds) {
|
||||||
max-width: 88%;
|
max-width: 88%;
|
||||||
@ -1706,7 +1706,6 @@ poll-element {
|
|||||||
color: #707579;
|
color: #707579;
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
margin-bottom: 7px;
|
margin-bottom: 7px;
|
||||||
user-select: none;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
@ -1754,7 +1753,6 @@ poll-element {
|
|||||||
&-text {
|
&-text {
|
||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
user-select: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-percents {
|
&-percents {
|
||||||
@ -1769,7 +1767,6 @@ poll-element {
|
|||||||
margin-left: -9px;
|
margin-left: -9px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
width: 40px;
|
width: 40px;
|
||||||
user-select: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-selected {
|
&-selected {
|
||||||
@ -1834,7 +1831,6 @@ poll-element {
|
|||||||
&-votes-count {
|
&-votes-count {
|
||||||
color: #707579;
|
color: #707579;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
user-select: none;
|
|
||||||
padding-top: 1px;
|
padding-top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1877,7 +1873,6 @@ poll-element {
|
|||||||
//border-bottom-right-radius: 12px;
|
//border-bottom-right-radius: 12px;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 37px;
|
line-height: 37px;
|
||||||
user-select: none;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user