Reactions: support 138 layer
This commit is contained in:
parent
560435d315
commit
1d6ec6f630
@ -809,7 +809,7 @@ export default class ChatContextMenu {
|
|||||||
|
|
||||||
if(reactions.length) {
|
if(reactions.length) {
|
||||||
const avatars = new StackedAvatars({avatarSize: 24});
|
const avatars = new StackedAvatars({avatarSize: 24});
|
||||||
avatars.render(recentReactions ? recentReactions.map(r => r.user_id.toPeerId()) : reactions.map(reaction => reaction.peerId));
|
avatars.render(recentReactions ? recentReactions.map(r => this.appPeersManager.getPeerId(r.peer_id)) : reactions.map(reaction => reaction.peerId));
|
||||||
viewsButton.element.append(avatars.container);
|
viewsButton.element.append(avatars.container);
|
||||||
|
|
||||||
// if(reactions.length > 1) {
|
// if(reactions.length > 1) {
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
import callbackify from "../../helpers/callbackify";
|
import callbackify from "../../helpers/callbackify";
|
||||||
import { formatNumber } from "../../helpers/number";
|
import { formatNumber } from "../../helpers/number";
|
||||||
import { MessageUserReaction, ReactionCount } from "../../layer";
|
import { MessagePeerReaction, ReactionCount } from "../../layer";
|
||||||
|
import appPeersManager from "../../lib/appManagers/appPeersManager";
|
||||||
import appReactionsManager from "../../lib/appManagers/appReactionsManager";
|
import appReactionsManager from "../../lib/appManagers/appReactionsManager";
|
||||||
import RLottiePlayer from "../../lib/rlottie/rlottiePlayer";
|
import RLottiePlayer from "../../lib/rlottie/rlottiePlayer";
|
||||||
import SetTransition from "../singleTransition";
|
import SetTransition from "../singleTransition";
|
||||||
@ -103,7 +104,7 @@ export default class ReactionElement extends HTMLElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public renderAvatars(recentReactions: MessageUserReaction[]) {
|
public renderAvatars(recentReactions: MessagePeerReaction[]) {
|
||||||
if(this.type === 'inline') {
|
if(this.type === 'inline') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -125,7 +126,7 @@ export default class ReactionElement extends HTMLElement {
|
|||||||
this.append(this.stackedAvatars.container);
|
this.append(this.stackedAvatars.container);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stackedAvatars.render(recentReactions.map(reaction => reaction.user_id.toPeerId()));
|
this.stackedAvatars.render(recentReactions.map(reaction => appPeersManager.getPeerId(reaction.peer_id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public setIsChosen(isChosen = !!this.reactionCount.pFlags.chosen) {
|
public setIsChosen(isChosen = !!this.reactionCount.pFlags.chosen) {
|
||||||
|
@ -17,7 +17,7 @@ import { createPosterForVideo } from "../../helpers/files";
|
|||||||
import { copy, deepEqual, getObjectKeysAndSort } from "../../helpers/object";
|
import { copy, deepEqual, getObjectKeysAndSort } from "../../helpers/object";
|
||||||
import { randomLong } from "../../helpers/random";
|
import { randomLong } from "../../helpers/random";
|
||||||
import { splitStringByLength, limitSymbols, escapeRegExp } from "../../helpers/string";
|
import { splitStringByLength, limitSymbols, escapeRegExp } from "../../helpers/string";
|
||||||
import { Chat, ChatFull, Dialog as MTDialog, DialogPeer, DocumentAttribute, InputMedia, InputMessage, InputPeerNotifySettings, InputSingleMedia, Message, MessageAction, MessageEntity, MessageFwdHeader, MessageMedia, MessageReplies, MessageReplyHeader, MessagesDialogs, MessagesFilter, MessagesMessages, MethodDeclMap, NotifyPeer, PeerNotifySettings, PhotoSize, SendMessageAction, Update, Photo, Updates, ReplyMarkup, InputPeer, InputPhoto, InputDocument, InputGeoPoint, WebPage, GeoPoint, ReportReason, MessagesGetDialogs, InputChannel, InputDialogPeer, MessageUserReaction, ReactionCount } from "../../layer";
|
import { Chat, ChatFull, Dialog as MTDialog, DialogPeer, DocumentAttribute, InputMedia, InputMessage, InputPeerNotifySettings, InputSingleMedia, Message, MessageAction, MessageEntity, MessageFwdHeader, MessageMedia, MessageReplies, MessageReplyHeader, MessagesDialogs, MessagesFilter, MessagesMessages, MethodDeclMap, NotifyPeer, PeerNotifySettings, PhotoSize, SendMessageAction, Update, Photo, Updates, ReplyMarkup, InputPeer, InputPhoto, InputDocument, InputGeoPoint, WebPage, GeoPoint, ReportReason, MessagesGetDialogs, InputChannel, InputDialogPeer, ReactionCount, MessagePeerReaction } from "../../layer";
|
||||||
import { InvokeApiOptions } from "../../types";
|
import { InvokeApiOptions } from "../../types";
|
||||||
import I18n, { FormatterArguments, i18n, join, langPack, LangPackKey, UNSUPPORTED_LANG_PACK_KEY, _i18n } from "../langPack";
|
import I18n, { FormatterArguments, i18n, join, langPack, LangPackKey, UNSUPPORTED_LANG_PACK_KEY, _i18n } from "../langPack";
|
||||||
import { logger, LogTypes } from "../logger";
|
import { logger, LogTypes } from "../logger";
|
||||||
@ -4613,7 +4613,7 @@ export class AppMessagesManager {
|
|||||||
const previousReactions = message.reactions;
|
const previousReactions = message.reactions;
|
||||||
const previousRecentReactions = previousReactions?.recent_reactions;
|
const previousRecentReactions = previousReactions?.recent_reactions;
|
||||||
if(
|
if(
|
||||||
recentReaction.user_id !== rootScope.myId.toUserId() && (
|
appPeersManager.getPeerId(recentReaction.peer_id) !== rootScope.myId && (
|
||||||
!previousRecentReactions ||
|
!previousRecentReactions ||
|
||||||
previousRecentReactions.length <= recentReactions.length
|
previousRecentReactions.length <= recentReactions.length
|
||||||
) && (
|
) && (
|
||||||
@ -5383,7 +5383,7 @@ export class AppMessagesManager {
|
|||||||
skipReactionsList?: boolean
|
skipReactionsList?: boolean
|
||||||
) {
|
) {
|
||||||
const emptyMessageReactionsList = {
|
const emptyMessageReactionsList = {
|
||||||
reactions: [] as MessageUserReaction[],
|
reactions: [] as MessagePeerReaction[],
|
||||||
count: 0,
|
count: 0,
|
||||||
next_offset: undefined as string
|
next_offset: undefined as string
|
||||||
};
|
};
|
||||||
@ -5404,12 +5404,12 @@ export class AppMessagesManager {
|
|||||||
|
|
||||||
const filteredReadParticipants = readParticipantsPeerIds.slice();
|
const filteredReadParticipants = readParticipantsPeerIds.slice();
|
||||||
forEachReverse(filteredReadParticipants, (peerId, idx, arr) => {
|
forEachReverse(filteredReadParticipants, (peerId, idx, arr) => {
|
||||||
if(messageReactionsList.reactions.some(reaction => reaction.user_id.toPeerId() === peerId)) {
|
if(messageReactionsList.reactions.some(reaction => appPeersManager.getPeerId(reaction.peer_id) === peerId)) {
|
||||||
arr.splice(idx, 1);
|
arr.splice(idx, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let combined: {peerId: PeerId, reaction?: string}[] = messageReactionsList.reactions.map(reaction => ({peerId: reaction.user_id.toPeerId(), reaction: reaction.reaction}));
|
let combined: {peerId: PeerId, reaction?: string}[] = messageReactionsList.reactions.map(reaction => ({peerId: appPeersManager.getPeerId(reaction.peer_id), reaction: reaction.reaction}));
|
||||||
combined = combined.concat(filteredReadParticipants.map(readPeerId => ({peerId: readPeerId})));
|
combined = combined.concat(filteredReadParticipants.map(readPeerId => ({peerId: readPeerId})));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -5478,7 +5478,7 @@ export class AppMessagesManager {
|
|||||||
|
|
||||||
private notifyAboutMessage(message: MyMessage, options: Partial<{
|
private notifyAboutMessage(message: MyMessage, options: Partial<{
|
||||||
fwdCount: number,
|
fwdCount: number,
|
||||||
userReaction: MessageUserReaction,
|
userReaction: MessagePeerReaction,
|
||||||
peerTypeNotifySettings: PeerNotifySettings
|
peerTypeNotifySettings: PeerNotifySettings
|
||||||
}> = {}) {
|
}> = {}) {
|
||||||
const peerId = this.getMessagePeer(message);
|
const peerId = this.getMessagePeer(message);
|
||||||
|
@ -9,7 +9,7 @@ import assumeType from "../../helpers/assumeType";
|
|||||||
import callbackify from "../../helpers/callbackify";
|
import callbackify from "../../helpers/callbackify";
|
||||||
import callbackifyAll from "../../helpers/callbackifyAll";
|
import callbackifyAll from "../../helpers/callbackifyAll";
|
||||||
import { copy } from "../../helpers/object";
|
import { copy } from "../../helpers/object";
|
||||||
import { AvailableReaction, Message, MessagesAvailableReactions, MessageUserReaction, Update, Updates } from "../../layer";
|
import { AvailableReaction, Message, MessagePeerReaction, MessagesAvailableReactions, Update, Updates } from "../../layer";
|
||||||
import apiManager from "../mtproto/mtprotoworker";
|
import apiManager from "../mtproto/mtprotoworker";
|
||||||
import { ReferenceContext } from "../mtproto/referenceDatabase";
|
import { ReferenceContext } from "../mtproto/referenceDatabase";
|
||||||
import rootScope from "../rootScope";
|
import rootScope from "../rootScope";
|
||||||
@ -225,7 +225,7 @@ export class AppReactionsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const {peerId, mid} = message;
|
const {peerId, mid} = message;
|
||||||
const myUserId = rootScope.myId.toUserId();
|
const myPeerId = rootScope.myId;
|
||||||
|
|
||||||
let reactions = onlyLocal ? message.reactions : copy(message.reactions);
|
let reactions = onlyLocal ? message.reactions : copy(message.reactions);
|
||||||
let chosenReactionIdx = reactions ? reactions.results.findIndex((reactionCount) => reactionCount.pFlags.chosen) : -1;
|
let chosenReactionIdx = reactions ? reactions.results.findIndex((reactionCount) => reactionCount.pFlags.chosen) : -1;
|
||||||
@ -245,7 +245,7 @@ export class AppReactionsManager {
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
if(reactions.recent_reactions) {
|
if(reactions.recent_reactions) {
|
||||||
reactions.recent_reactions.findAndSplice((recentReaction) => recentReaction.user_id === myUserId);
|
reactions.recent_reactions.findAndSplice((recentReaction) => appPeersManager.getPeerId(recentReaction.peer_id) === myPeerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!reactions.results.length) {
|
if(!reactions.results.length) {
|
||||||
@ -287,10 +287,10 @@ export class AppReactionsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(reactions.recent_reactions) {
|
if(reactions.recent_reactions) {
|
||||||
const userReaction: MessageUserReaction = {
|
const userReaction: MessagePeerReaction = {
|
||||||
_: 'messageUserReaction',
|
_: 'messagePeerReaction',
|
||||||
reaction,
|
reaction,
|
||||||
user_id: myUserId
|
peer_id: appPeersManager.getOutputPeer(myPeerId)
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!appPeersManager.isMegagroup(peerId)) {
|
if(!appPeersManager.isMegagroup(peerId)) {
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: "#{$tgico-font-family}";
|
font-family: "#{$tgico-font-family}";
|
||||||
src:
|
src:
|
||||||
url('#{$tgico-font-path}/#{$tgico-font-family}.ttf?yaqhmr') format('truetype'),
|
url('#{$tgico-font-path}/#{$tgico-font-family}.ttf?xxkozq') format('truetype'),
|
||||||
url('#{$tgico-font-path}/#{$tgico-font-family}.woff?yaqhmr') format('woff'),
|
url('#{$tgico-font-path}/#{$tgico-font-family}.woff?xxkozq') format('woff'),
|
||||||
url('#{$tgico-font-path}/#{$tgico-font-family}.svg?yaqhmr#tgico') format('svg');
|
url('#{$tgico-font-path}/#{$tgico-font-family}.svg?xxkozq#tgico') format('svg');
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: block;
|
font-display: block;
|
||||||
|
Loading…
Reference in New Issue
Block a user