Browse Source

Fix pinning message

master
Eduard Kuzmenko 4 years ago
parent
commit
7990424dc0
  1. 26
      src/components/popups/unpinMessage.ts
  2. 4
      src/lib/appManagers/appMessagesManager.ts

26
src/components/popups/unpinMessage.ts

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

4
src/lib/appManagers/appMessagesManager.ts

@ -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', { return apiManager.invokeApi('messages.updatePinnedMessage', {
peer: appPeersManager.getInputPeerById(peerId), peer: appPeersManager.getInputPeerById(peerId),
unpin, unpin,
silent, silent,
pm_oneside: oneSide, pm_oneside: oneSide,
id id: this.getLocalMessageId(mid)
}).then(updates => { }).then(updates => {
this.log('pinned updates:', updates); this.log('pinned updates:', updates);
apiUpdatesManager.processUpdateMessage(updates); apiUpdatesManager.processUpdateMessage(updates);

Loading…
Cancel
Save