Fix chat context menu rights
This commit is contained in:
parent
dd0a717386
commit
a7a5400c3e
@ -2,11 +2,11 @@ import appChatsManager from "../../lib/appManagers/appChatsManager";
|
||||
import appImManager from "../../lib/appManagers/appImManager";
|
||||
import appMessagesManager from "../../lib/appManagers/appMessagesManager";
|
||||
import appPeersManager from "../../lib/appManagers/appPeersManager";
|
||||
import appSidebarRight from "../sidebarRight";
|
||||
import $rootScope from "../../lib/rootScope";
|
||||
import { findUpClassName } from "../../lib/utils";
|
||||
import { parseMenuButtonsTo, attachContextMenuListener, positionMenu, openBtnMenu } from "../misc";
|
||||
import { attachContextMenuListener, openBtnMenu, parseMenuButtonsTo, positionMenu } from "../misc";
|
||||
import { PopupButton, PopupPeer } from "../popup";
|
||||
import appSidebarRight from "../sidebarRight";
|
||||
|
||||
export class ChatContextMenu {
|
||||
private element = document.getElementById('bubble-contextmenu') as HTMLDivElement;
|
||||
@ -50,13 +50,10 @@ export class ChatContextMenu {
|
||||
|
||||
this.buttons.copy.style.display = message.message ? '' : 'none';
|
||||
|
||||
if($rootScope.myID == peerID || (peerID < 0 && appChatsManager.hasRights(-peerID, 'pin'))) {
|
||||
this.buttons.pin.style.display = '';
|
||||
} else {
|
||||
this.buttons.pin.style.display = 'none';
|
||||
}
|
||||
|
||||
this.buttons.pin.classList.toggle('hide', peerID < 0 && !appChatsManager.hasRights(-peerID, 'pin'));
|
||||
this.buttons.edit.style.display = appMessagesManager.canEditMessage(msgID) ? '' : 'none';
|
||||
this.buttons.reply.classList.toggle('hide', peerID < 0 && !appChatsManager.hasRights(-peerID, 'send'));
|
||||
this.buttons.delete.classList.toggle('hide', peerID < 0 && appPeersManager.isBroadcast(peerID) && !appChatsManager.hasRights(-peerID, 'deleteRevoke'));
|
||||
|
||||
let side: 'left' | 'right' = bubble.classList.contains('is-in') ? 'left' : 'right';
|
||||
positionMenu(e, this.element, side);
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { isObject, safeReplaceObject, copy, numberWithCommas, getAbbreviation } from "../utils";
|
||||
import { RichTextProcessor } from "../richtextprocessor";
|
||||
import appUsersManager from "./appUsersManager";
|
||||
import { InputChannel, InputChatPhoto, InputPeer, Updates } from "../../layer";
|
||||
import apiManager from '../mtproto/mtprotoworker';
|
||||
import { RichTextProcessor } from "../richtextprocessor";
|
||||
import $rootScope from "../rootScope";
|
||||
import searchIndexManager from "../searchIndexManager";
|
||||
import { copy, getAbbreviation, isObject, numberWithCommas, safeReplaceObject } from "../utils";
|
||||
import apiUpdatesManager from "./apiUpdatesManager";
|
||||
import appProfileManager from "./appProfileManager";
|
||||
import searchIndexManager from "../searchIndexManager";
|
||||
import { InputPeer, InputChannel, Updates, InputChatPhoto } from "../../layer";
|
||||
import $rootScope from "../rootScope";
|
||||
import appUsersManager from "./appUsersManager";
|
||||
|
||||
export type Channel = {
|
||||
_: 'channel',
|
||||
@ -194,7 +194,7 @@ export class AppChatsManager {
|
||||
// good
|
||||
case 'pin': {
|
||||
if(chat._ == 'channel') {
|
||||
return chat.admin_rights ? !!myFlags.pin_messages || !!myFlags.post_messages : !myFlags.pin_messages;
|
||||
return chat.admin_rights ? !!myFlags.pin_messages || !!myFlags.post_messages : !!myFlags.pin_messages;
|
||||
} else {
|
||||
if(myFlags.pin_messages && !chat.pFlags.admin) {
|
||||
return false;
|
||||
|
@ -1,24 +1,24 @@
|
||||
import { findUpClassName, escapeRegExp, cancelEvent, positionElementByIndex } from "../utils";
|
||||
import appImManager, { AppImManager } from "./appImManager";
|
||||
import appPeersManager from './appPeersManager';
|
||||
import appMessagesManager, { Dialog, MyDialogFilter as DialogFilter } from "./appMessagesManager";
|
||||
import appUsersManager, { User } from "./appUsersManager";
|
||||
import { RichTextProcessor } from "../richtextprocessor";
|
||||
import { putPreloader, attachContextMenuListener } from "../../components/misc";
|
||||
import AvatarElement from "../../components/avatar";
|
||||
import DialogsContextMenu from "../../components/dialogsContextMenu";
|
||||
import { horizontalMenu } from "../../components/horizontalMenu";
|
||||
import { attachContextMenuListener, putPreloader } from "../../components/misc";
|
||||
import { ripple } from "../../components/ripple";
|
||||
//import Scrollable from "../../components/scrollable";
|
||||
import Scrollable, { ScrollableX } from "../../components/scrollable";
|
||||
import { logger, LogLevels } from "../logger";
|
||||
import appChatsManager from "./appChatsManager";
|
||||
import AvatarElement from "../../components/avatar";
|
||||
import appStateManager from "./appStateManager";
|
||||
import { horizontalMenu } from "../../components/horizontalMenu";
|
||||
import { ripple } from "../../components/ripple";
|
||||
import { isSafari } from "../../helpers/userAgent";
|
||||
import { formatDateAccordingToToday } from "../../helpers/date";
|
||||
import $rootScope from "../rootScope";
|
||||
import { isTouchSupported } from "../../helpers/touchSupport";
|
||||
import DialogsContextMenu from "../../components/dialogsContextMenu";
|
||||
import appSidebarLeft from "../../components/sidebarLeft";
|
||||
import { formatDateAccordingToToday } from "../../helpers/date";
|
||||
import { isTouchSupported } from "../../helpers/touchSupport";
|
||||
import { isSafari } from "../../helpers/userAgent";
|
||||
import { logger, LogLevels } from "../logger";
|
||||
import { RichTextProcessor } from "../richtextprocessor";
|
||||
import $rootScope from "../rootScope";
|
||||
import { cancelEvent, escapeRegExp, findUpClassName, positionElementByIndex } from "../utils";
|
||||
import appChatsManager from "./appChatsManager";
|
||||
import appImManager, { AppImManager } from "./appImManager";
|
||||
import appMessagesManager, { Dialog, MyDialogFilter as DialogFilter } from "./appMessagesManager";
|
||||
import appPeersManager from './appPeersManager';
|
||||
import appStateManager from "./appStateManager";
|
||||
import appUsersManager, { User } from "./appUsersManager";
|
||||
|
||||
type DialogDom = {
|
||||
avatarEl: AvatarElement,
|
||||
@ -742,8 +742,8 @@ export class AppDialogsManager {
|
||||
|
||||
const lastMessage = appMessagesManager.getMessage(dialog.top_message);
|
||||
if(lastMessage._ != 'messageEmpty' && !lastMessage.deleted &&
|
||||
lastMessage.fromID == $rootScope.myID && lastMessage.peerID != $rootScope.myID &&
|
||||
dialog.read_outbox_max_id) { // maybe comment, 06.20.2020
|
||||
lastMessage.fromID == $rootScope.myID && lastMessage.peerID != $rootScope.myID/* &&
|
||||
dialog.read_outbox_max_id */) { // maybe comment, 06.20.2020
|
||||
const outgoing = (lastMessage.pFlags && lastMessage.pFlags.unread)
|
||||
/* && dialog.read_outbox_max_id != 0 */; // maybe uncomment, 31.01.2020
|
||||
|
||||
|
@ -1054,6 +1054,7 @@ export class AppMessagesManager {
|
||||
flags |= 1 << 10;
|
||||
flags |= 1 << 2;
|
||||
attachType = 'voice';
|
||||
pFlags.media_unread = true;
|
||||
}
|
||||
|
||||
let attribute: DocumentAttribute.documentAttributeAudio = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user