Participants rank in members tab
Fix infinite history request in empty chats
This commit is contained in:
parent
56cf2db459
commit
5226e4ca95
|
@ -78,6 +78,7 @@ import wrapMediaSpoiler, {onMediaSpoilerClick} from './wrappers/mediaSpoiler';
|
|||
import filterAsync from '../helpers/array/filterAsync';
|
||||
import ChatContextMenu from './chat/contextMenu';
|
||||
import PopupElement from './popups';
|
||||
import getParticipantRank from '../lib/appManagers/utils/chats/getParticipantRank';
|
||||
|
||||
// const testScroll = false;
|
||||
|
||||
|
@ -1240,10 +1241,13 @@ export default class AppSearchSuper {
|
|||
return;
|
||||
}
|
||||
|
||||
return peerId;
|
||||
return {
|
||||
peerId,
|
||||
rank: getParticipantRank(participant as ChannelParticipant)
|
||||
};
|
||||
}).filter(Boolean);
|
||||
|
||||
const filtered = await filterAsync(peerIds, async(peerId) => {
|
||||
const filtered = await filterAsync(peerIds, async({peerId}) => {
|
||||
const peer: User | Chat = await this.managers.appPeersManager.getPeer(peerId);
|
||||
if(!middleware()) {
|
||||
return false;
|
||||
|
@ -1256,7 +1260,11 @@ export default class AppSearchSuper {
|
|||
return true;
|
||||
});
|
||||
|
||||
for(const peerId of filtered) {
|
||||
for(const {peerId, rank} of filtered) {
|
||||
if(rank) {
|
||||
membersList.ranks.set(peerId, rank);
|
||||
}
|
||||
|
||||
membersList.add(peerId);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3633,11 +3633,11 @@ export default class ChatBubbles {
|
|||
|
||||
restoreScroll?.();
|
||||
|
||||
pause(!this.chat.setPeerPromise ? 0 : 1000)
|
||||
.then(() => getHeavyAnimationPromise())
|
||||
m(pause(!this.chat.setPeerPromise ? 0 : 1000))
|
||||
.then(() => m(getHeavyAnimationPromise()))
|
||||
.then(() => {
|
||||
this.lazyLoadQueue.setAllSeen();
|
||||
});
|
||||
}).catch(noop);
|
||||
|
||||
// this.setStickyDateManually();
|
||||
};
|
||||
|
|
|
@ -16,6 +16,7 @@ import {AppManagers} from '../lib/appManagers/managers';
|
|||
import getUserStatusString from './wrappers/getUserStatusString';
|
||||
import type LazyLoadQueue from './lazyLoadQueue';
|
||||
import getChatMembersString from './wrappers/getChatMembersString';
|
||||
import {i18n} from '../lib/langPack';
|
||||
|
||||
interface SortedUser extends SortedElementBase<PeerId> {
|
||||
dom: DialogDom
|
||||
|
@ -24,6 +25,7 @@ interface SortedUser extends SortedElementBase<PeerId> {
|
|||
export default class SortedUserList extends SortedList<SortedUser> {
|
||||
protected static SORT_INTERVAL = 30e3;
|
||||
public list: HTMLUListElement;
|
||||
public ranks: Map<PeerId, string | number> = new Map();
|
||||
|
||||
protected lazyLoadQueue: LazyLoadQueue;
|
||||
protected avatarSize: DialogElementSize = 'abitbigger';
|
||||
|
@ -71,7 +73,7 @@ export default class SortedUserList extends SortedList<SortedUser> {
|
|||
}
|
||||
},
|
||||
onElementCreate: (base) => {
|
||||
const {dom} = appDialogsManager.addDialogNew({
|
||||
const dialogElement = appDialogsManager.addDialogNew({
|
||||
peerId: base.id,
|
||||
container: false,
|
||||
avatarSize: this.avatarSize,
|
||||
|
@ -83,7 +85,14 @@ export default class SortedUserList extends SortedList<SortedUser> {
|
|||
}
|
||||
});
|
||||
|
||||
(base as SortedUser).dom = dom;
|
||||
const rank = this.ranks.get(base.id);
|
||||
if(rank) {
|
||||
dialogElement.titleRight.replaceChildren(typeof(rank) === 'number' ?
|
||||
i18n(rank === 1 ? 'Chat.OwnerBadge' : 'ChatAdmin') :
|
||||
rank);
|
||||
}
|
||||
|
||||
(base as SortedUser).dom = dialogElement.dom;
|
||||
return base as SortedUser;
|
||||
},
|
||||
updateElementWith: fastRaf,
|
||||
|
|
|
@ -21,7 +21,7 @@ const App = {
|
|||
version: process.env.VERSION,
|
||||
versionFull: process.env.VERSION_FULL,
|
||||
build: +process.env.BUILD,
|
||||
langPackVersion: '1.0.4',
|
||||
langPackVersion: '1.0.5',
|
||||
langPack: 'webk',
|
||||
langPackCode: 'en',
|
||||
domains: MAIN_DOMAINS,
|
||||
|
|
|
@ -949,6 +949,7 @@ const lang = {
|
|||
'ActionGiftOutbound': 'You have sent a gift for **un2**',
|
||||
'ActionGiftPremiumTitle': 'Telegram Premium',
|
||||
'ActionGiftPremiumSubtitle': 'for %1$s',
|
||||
'ChatAdmin': 'admin',
|
||||
|
||||
// * macos
|
||||
'AccountSettings.Filters': 'Chat Folders',
|
||||
|
@ -1019,6 +1020,7 @@ const lang = {
|
|||
'Chat.Context.ReactedFast': {
|
||||
'other_value': '%d Reacted'
|
||||
},
|
||||
'Chat.ChannelBadge': 'channel',
|
||||
'Chat.Date.ScheduledFor': 'Scheduled for %@',
|
||||
'Chat.Date.ScheduledForToday': 'Scheduled for today',
|
||||
'Chat.DropTitle': 'Drop files here to send them',
|
||||
|
@ -1026,6 +1028,7 @@ const lang = {
|
|||
'Chat.DropAsFilesDesc': 'without compression',
|
||||
'Chat.Edit.Cancel.Text': 'Are you sure you want to discard all changes?',
|
||||
'Chat.Input.ReplyToAnswer': 'Reply to message in topics',
|
||||
'Chat.OwnerBadge': 'owner',
|
||||
'Chat.SendVoice.PrivacyError': '%@ doesn\'t accept voice and video messages',
|
||||
'Chat.Service.Call.Cancelled': 'Cancelled',
|
||||
'Chat.Service.Call.Missed': 'Missed',
|
||||
|
@ -1101,6 +1104,7 @@ const lang = {
|
|||
'one_value': '%d Comment',
|
||||
'other_value': '%d Comments'
|
||||
},
|
||||
'Chat.TopicBadge': 'topic creator',
|
||||
'ChatTitle.ReportMessages': 'Report Messages',
|
||||
'Chat.Send.WithoutSound': 'Send Without Sound',
|
||||
'Chat.Send.SetReminder': 'Set a Reminder',
|
||||
|
|
|
@ -5950,6 +5950,9 @@ export class AppMessagesManager extends AppManager {
|
|||
if(isTopEnd || isBottomEnd) {
|
||||
offsetIdOffset = isTopEnd ? count - topLoaded : bottomLoaded;
|
||||
}
|
||||
} else if(messages.length >= count) {
|
||||
isTopEnd = true;
|
||||
isBottomEnd = true;
|
||||
}
|
||||
|
||||
offsetIdOffset ??= 0;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import {ChannelParticipant, ChatParticipant} from '../../../../layer';
|
||||
|
||||
export default function getParticipantRank(participant: ChannelParticipant | ChatParticipant) {
|
||||
return (participant as ChannelParticipant.channelParticipantAdmin).rank ||
|
||||
(participant._ === 'channelParticipantAdmin' || participant._ === 'chatParticipantAdmin' ? 2 :
|
||||
(participant._ === 'chatParticipantCreator' || participant._ === 'channelParticipantCreator' ? 1 : undefined));
|
||||
}
|
|
@ -2492,10 +2492,14 @@ $bubble-border-radius-big: 12px;
|
|||
// }
|
||||
}
|
||||
|
||||
.timestamp.is-disabled {
|
||||
color: inherit;
|
||||
text-decoration: none !important;
|
||||
cursor: inherit;
|
||||
.timestamp {
|
||||
text-decoration: underline;
|
||||
|
||||
&.is-disabled {
|
||||
color: inherit;
|
||||
text-decoration: none !important;
|
||||
cursor: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes audio-dots {
|
||||
|
|
Loading…
Reference in New Issue