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