Fix pinning message

This commit is contained in:
Eduard Kuzmenko 2020-12-22 00:49:21 +02:00
parent b71671640a
commit 7990424dc0
2 changed files with 19 additions and 11 deletions

View File

@ -2,6 +2,7 @@ import appMessagesManager from "../../lib/appManagers/appMessagesManager";
import { PopupButton } from ".";
import PopupPeer from "./peer";
import appPeersManager from "../../lib/appManagers/appPeersManager";
import rootScope from "../../lib/rootScope";
export default class PopupPinMessage {
constructor(peerId: number, mid: number, unpin?: true, onConfirm?: () => void) {
@ -68,15 +69,22 @@ export default class PopupPinMessage {
} else {
description = 'Would you like to pin this message?';
buttons.push({
text: 'PIN JUST FOR ME',
callback: () => callback(true)
});
buttons.push({
text: 'PIN FOR ME AND ' + firstName,
callback: () => callback()
});
if(peerId === rootScope.myId) {
buttons.push({
text: 'PIN',
callback: () => callback()
});
} else {
buttons.push({
text: 'PIN JUST FOR ME',
callback: () => callback(true)
});
buttons.push({
text: 'PIN FOR ME AND ' + firstName,
callback: () => callback()
});
}
}
}

View File

@ -1822,13 +1822,13 @@ export class AppMessagesManager {
});
}
public updatePinnedMessage(peerId: number, id: number, unpin?: true, silent?: true, oneSide?: true) {
public updatePinnedMessage(peerId: number, mid: number, unpin?: true, silent?: true, oneSide?: true) {
return apiManager.invokeApi('messages.updatePinnedMessage', {
peer: appPeersManager.getInputPeerById(peerId),
unpin,
silent,
pm_oneside: oneSide,
id
id: this.getLocalMessageId(mid)
}).then(updates => {
this.log('pinned updates:', updates);
apiUpdatesManager.processUpdateMessage(updates);