Fix showing wrong pinned message
This commit is contained in:
parent
af1d20f534
commit
b2bbe7acd6
@ -41,6 +41,7 @@ import { ChatFull } from "../../layer";
|
|||||||
import PopupPickUser from "../popups/pickUser";
|
import PopupPickUser from "../popups/pickUser";
|
||||||
import PopupPeer from "../popups/peer";
|
import PopupPeer from "../popups/peer";
|
||||||
import generateVerifiedIcon from "../generateVerifiedIcon";
|
import generateVerifiedIcon from "../generateVerifiedIcon";
|
||||||
|
import { fastRaf } from "../../helpers/schedulers";
|
||||||
|
|
||||||
export default class ChatTopbar {
|
export default class ChatTopbar {
|
||||||
public container: HTMLDivElement;
|
public container: HTMLDivElement;
|
||||||
@ -215,46 +216,7 @@ export default class ChatTopbar {
|
|||||||
text: 'Pinned Messages',
|
text: 'Pinned Messages',
|
||||||
onClick: () => this.openPinned(false),
|
onClick: () => this.openPinned(false),
|
||||||
verify: () => mediaSizes.isMobile
|
verify: () => mediaSizes.isMobile
|
||||||
}, */ {
|
}, */{
|
||||||
icon: 'forward',
|
|
||||||
text: 'ShareContact',
|
|
||||||
onClick: () => {
|
|
||||||
const contactPeerId = this.peerId;
|
|
||||||
new PopupPickUser({
|
|
||||||
peerTypes: ['dialogs', 'contacts'],
|
|
||||||
onSelect: (peerId) => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
new PopupPeer('', {
|
|
||||||
titleLangKey: 'SendMessageTitle',
|
|
||||||
descriptionLangKey: 'SendContactToGroupText',
|
|
||||||
descriptionLangArgs: [new PeerTitle({peerId, dialog: true}).element],
|
|
||||||
buttons: [{
|
|
||||||
langKey: 'Send',
|
|
||||||
callback: () => {
|
|
||||||
resolve();
|
|
||||||
|
|
||||||
this.appMessagesManager.sendOther(peerId, this.appUsersManager.getContactMediaInput(contactPeerId));
|
|
||||||
this.chat.appImManager.setInnerPeer(peerId);
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
langKey: 'Cancel',
|
|
||||||
callback: () => {
|
|
||||||
reject();
|
|
||||||
},
|
|
||||||
isCancel: true,
|
|
||||||
}],
|
|
||||||
peerId,
|
|
||||||
overlayClosable: true
|
|
||||||
}).show();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
placeholder: 'ShareModal.Search.Placeholder',
|
|
||||||
chatRightsAction: 'send_messages',
|
|
||||||
selfPresence: 'ChatYourSelf'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
verify: () => rootScope.myId !== this.peerId && this.peerId > 0 && this.appUsersManager.isContact(this.peerId)
|
|
||||||
}, {
|
|
||||||
icon: 'mute',
|
icon: 'mute',
|
||||||
text: 'ChatList.Context.Mute',
|
text: 'ChatList.Context.Mute',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
@ -311,6 +273,45 @@ export default class ChatTopbar {
|
|||||||
this.chat.selection.cancelSelection();
|
this.chat.selection.cancelSelection();
|
||||||
},
|
},
|
||||||
verify: () => this.chat.selection.isSelecting
|
verify: () => this.chat.selection.isSelecting
|
||||||
|
}, {
|
||||||
|
icon: 'forward',
|
||||||
|
text: 'ShareContact',
|
||||||
|
onClick: () => {
|
||||||
|
const contactPeerId = this.peerId;
|
||||||
|
new PopupPickUser({
|
||||||
|
peerTypes: ['dialogs', 'contacts'],
|
||||||
|
onSelect: (peerId) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
new PopupPeer('', {
|
||||||
|
titleLangKey: 'SendMessageTitle',
|
||||||
|
descriptionLangKey: 'SendContactToGroupText',
|
||||||
|
descriptionLangArgs: [new PeerTitle({peerId, dialog: true}).element],
|
||||||
|
buttons: [{
|
||||||
|
langKey: 'Send',
|
||||||
|
callback: () => {
|
||||||
|
resolve();
|
||||||
|
|
||||||
|
this.appMessagesManager.sendOther(peerId, this.appUsersManager.getContactMediaInput(contactPeerId));
|
||||||
|
this.chat.appImManager.setInnerPeer(peerId);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
langKey: 'Cancel',
|
||||||
|
callback: () => {
|
||||||
|
reject();
|
||||||
|
},
|
||||||
|
isCancel: true,
|
||||||
|
}],
|
||||||
|
peerId,
|
||||||
|
overlayClosable: true
|
||||||
|
}).show();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
placeholder: 'ShareModal.Search.Placeholder',
|
||||||
|
chatRightsAction: 'send_messages',
|
||||||
|
selfPresence: 'ChatYourSelf'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
verify: () => rootScope.myId !== this.peerId && this.peerId > 0 && this.appUsersManager.isContact(this.peerId)
|
||||||
}, {
|
}, {
|
||||||
icon: 'delete danger',
|
icon: 'delete danger',
|
||||||
text: 'Delete',
|
text: 'Delete',
|
||||||
@ -506,7 +507,7 @@ export default class ChatTopbar {
|
|||||||
const middleware = this.chat.bubbles.getMiddleware();
|
const middleware = this.chat.bubbles.getMiddleware();
|
||||||
if(this.pinnedMessage) { // * replace with new one
|
if(this.pinnedMessage) { // * replace with new one
|
||||||
if(this.chat.type === 'chat') {
|
if(this.chat.type === 'chat') {
|
||||||
if(this.wasPeerId) { // * change
|
if(this.wasPeerId !== undefined) { // * change
|
||||||
const newPinnedMessage = new ChatPinnedMessage(this, this.chat, this.appMessagesManager, this.appPeersManager);
|
const newPinnedMessage = new ChatPinnedMessage(this, this.chat, this.appMessagesManager, this.appPeersManager);
|
||||||
this.pinnedMessage.pinnedMessageContainer.divAndCaption.container.replaceWith(newPinnedMessage.pinnedMessageContainer.divAndCaption.container);
|
this.pinnedMessage.pinnedMessageContainer.divAndCaption.container.replaceWith(newPinnedMessage.pinnedMessageContainer.divAndCaption.container);
|
||||||
this.pinnedMessage.destroy();
|
this.pinnedMessage.destroy();
|
||||||
@ -531,7 +532,7 @@ export default class ChatTopbar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.requestAnimationFrame(() => {
|
fastRaf(() => {
|
||||||
this.setTitle();
|
this.setTitle();
|
||||||
this.setPeerStatus(true);
|
this.setPeerStatus(true);
|
||||||
this.setMutedState();
|
this.setMutedState();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user