Browse Source

Pinned chat fixes

master
Eduard Kuzmenko 3 years ago
parent
commit
6e53c8f443
  1. 2
      src/components/chat/messageRender.ts
  2. 7
      src/components/popups/unpinMessage.ts

2
src/components/chat/messageRender.ts

@ -29,7 +29,7 @@ export namespace MessageRender { @@ -29,7 +29,7 @@ export namespace MessageRender {
bubble.classList.add('channel-post');
time = formatNumber(message.views, 1) + ' <i class="tgico-channelviews time-icon"></i> ' + (postAuthor ? RichTextProcessor.wrapEmojiText(postAuthor) + ', ' : '') + time;
if(!message.fwd_from?.saved_from_msg_id) {
if(!message.fwd_from?.saved_from_msg_id && chat.type !== 'pinned') {
const forward = document.createElement('div');
forward.classList.add('bubble-beside-button', 'forward');
forward.innerHTML = `

7
src/components/popups/unpinMessage.ts

@ -9,13 +9,14 @@ import { addCancelButton } from "."; @@ -9,13 +9,14 @@ import { addCancelButton } from ".";
import PopupPeer, { PopupPeerButtonCallbackCheckboxes, PopupPeerOptions } from "./peer";
import appPeersManager from "../../lib/appManagers/appPeersManager";
import rootScope from "../../lib/rootScope";
import { LangPackKey } from "../../lib/langPack";
import { FormatterArguments, LangPackKey } from "../../lib/langPack";
import appChatsManager from "../../lib/appManagers/appChatsManager";
import PeerTitle from "../peerTitle";
export default class PopupPinMessage {
constructor(peerId: number, mid: number, unpin?: true, onConfirm?: () => void) {
let title: LangPackKey, description: LangPackKey, buttons: PopupPeerOptions['buttons'] = [], checkboxes: PopupPeerOptions['checkboxes'] = [];
let title: LangPackKey, description: LangPackKey, descriptionArgs: FormatterArguments,
buttons: PopupPeerOptions['buttons'] = [], checkboxes: PopupPeerOptions['checkboxes'] = [];
const canUnpin = appPeersManager.canPinMessage(peerId);
@ -44,6 +45,7 @@ export default class PopupPinMessage { @@ -44,6 +45,7 @@ export default class PopupPinMessage {
if(canUnpin) {
title = 'Popup.Unpin.AllTitle';
description = 'Chat.UnpinAllMessagesConfirmation';
descriptionArgs = ['' + (appMessagesManager.pinnedMessages[peerId]?.count || 1)];
} else {
title = 'Popup.Unpin.HideTitle';
description = 'Popup.Unpin.HideDescription';
@ -108,6 +110,7 @@ export default class PopupPinMessage { @@ -108,6 +110,7 @@ export default class PopupPinMessage {
peerId,
titleLangKey: title,
descriptionLangKey: description,
descriptionLangArgs: descriptionArgs,
buttons,
checkboxes
});

Loading…
Cancel
Save