Message List / Scheduled: Allow Copy and disable Report (#2009)

This commit is contained in:
Alexander Zinchuk 2022-08-31 15:00:41 +02:00
parent b35090a0c7
commit 858912d66f
2 changed files with 8 additions and 4 deletions

View File

@ -176,15 +176,16 @@ const MessageSelectToolbar: FC<OwnProps & StateProps> = ({
export default memo(withGlobal<OwnProps>(
(global): StateProps => {
const { type: messageListType, chatId } = selectCurrentMessageList(global) || {};
const isSchedule = messageListType === 'scheduled';
const { canDelete } = selectCanDeleteSelectedMessages(global);
const canReport = selectCanReportSelectedMessages(global);
const canReport = Boolean(!isSchedule && selectCanReportSelectedMessages(global));
const canDownload = selectCanDownloadSelectedMessages(global);
const { messageIds: selectedMessageIds } = global.selectedMessages || {};
const hasProtectedMessage = chatId ? selectHasProtectedMessage(global, chatId, selectedMessageIds) : false;
const isForwardModalOpen = global.forwardMessages.isModalShown;
return {
isSchedule: messageListType === 'scheduled',
isSchedule,
selectedMessagesCount: selectSelectedMessagesCount(global),
canDeleteMessages: canDelete,
canReportMessages: canReport,

View File

@ -34,6 +34,7 @@ import {
selectReplyingToId,
selectReplyStack,
selectSender,
selectScheduledMessages,
} from '../../selectors';
import { findLast } from '../../../util/iteratees';
import { getServerTime } from '../../../util/serverTime';
@ -729,10 +730,12 @@ addActionHandler('copyMessagesByIds', (global, actions, payload: { messageIds?:
});
function copyTextForMessages(global: GlobalState, chatId: string, messageIds: number[]) {
const { threadId } = selectCurrentMessageList(global) || {};
const { type: messageListType, threadId } = selectCurrentMessageList(global) || {};
const lang = langProvider.getTranslation;
const chatMessages = selectChatMessages(global, chatId);
const chatMessages = messageListType === 'scheduled'
? selectScheduledMessages(global, chatId)
: selectChatMessages(global, chatId);
if (!chatMessages || !threadId) return;
const messages = messageIds
.map((id) => chatMessages[id])