[FIX] "Allow Reaction" does not work properly on "Read Only" rooms (#4864)

* [FIX] "Allow Reaction" does not work properly on "Read Only" rooms

* fix the handle of message box

---------

Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
This commit is contained in:
Reinaldo Neto 2023-02-24 11:37:56 -03:00 committed by GitHub
parent 4686d4f6f8
commit 4336f0db40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 6 deletions

View File

@ -785,13 +785,22 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
});
};
handleCloseEmoji = (action?: Function, params?: any) => {
if (this.messagebox?.current) {
return this.messagebox?.current.closeEmojiAndAction(action, params);
}
if (action) {
return action(params);
}
};
errorActionsShow = (message: TAnyMessageModel) => {
this.messagebox?.current?.closeEmojiAndAction(this.messageErrorActions?.showMessageErrorActions, message);
this.handleCloseEmoji(this.messageErrorActions?.showMessageErrorActions, message);
};
showActionSheet = (options: any) => {
const { showActionSheet } = this.props;
this.messagebox?.current?.closeEmojiAndAction(showActionSheet, options);
this.handleCloseEmoji(showActionSheet, options);
};
onEditInit = (message: TAnyMessageModel) => {
@ -850,7 +859,7 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
};
onReactionInit = (message: TAnyMessageModel) => {
this.messagebox?.current?.closeEmojiAndAction(() => {
this.handleCloseEmoji(() => {
this.setState({ selectedMessage: message }, this.showReactionPicker);
});
};
@ -865,7 +874,7 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
if (message.tmid && !this.tmid) {
return;
}
this.messagebox?.current?.closeEmojiAndAction(this.messageActions?.showMessageActions, message);
this.handleCloseEmoji(this.messageActions?.showMessageActions, message);
};
showAttachment = (attachment: IAttachment) => {
@ -894,7 +903,7 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
this.setState({ selectedMessage: message });
const { showActionSheet } = this.props;
const { selectedMessage } = this.state;
this.messagebox?.current?.closeEmojiAndAction(showActionSheet, {
this.handleCloseEmoji(showActionSheet, {
children: <ReactionsList reactions={selectedMessage?.reactions} getCustomEmoji={this.getCustomEmoji} />,
snaps: ['50%', '80%'],
enableContentPanningGesture: false
@ -1380,7 +1389,7 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
jumpToMessage={this.jumpToMessageByUrl}
highlighted={highlightedMessage === item.id}
theme={theme}
closeEmojiAndAction={this.messagebox?.current?.closeEmojiAndAction}
closeEmojiAndAction={this.handleCloseEmoji}
/>
);
}