fix: fixes the behavior of the alsoSendThreadToChannel property (#5573)

This commit is contained in:
Gleidson Daniel Silva 2024-02-19 11:56:22 -03:00 committed by GitHub
parent e55b172bc1
commit 1beb0d0efa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View File

@ -66,8 +66,13 @@ export const MessageComposer = ({
const showEmojiKeyboard = useShowEmojiKeyboard();
const showEmojiSearchbar = useShowEmojiSearchbar();
const alsoSendThreadToChannel = useAlsoSendThreadToChannel();
const { openSearchEmojiKeyboard, closeEmojiKeyboard, closeSearchEmojiKeyboard, setTrackingViewHeight } =
useMessageComposerApi();
const {
openSearchEmojiKeyboard,
closeEmojiKeyboard,
closeSearchEmojiKeyboard,
setTrackingViewHeight,
setAlsoSendThreadToChannel
} = useMessageComposerApi();
const recordingAudio = useRecordingAudio();
useKeyboardListener(trackingViewRef);
@ -101,6 +106,10 @@ export const MessageComposer = ({
const handleSendMessage = async () => {
if (!rid) return;
if (alsoSendThreadToChannel) {
setAlsoSendThreadToChannel(false);
}
if (sharing) {
onSendMessage?.();
return;

View File

@ -51,8 +51,7 @@ export const SendThreadToChannel = (): React.ReactElement | null => {
* */
if (alsoSendThreadToChannelUserPref === 'default') {
const db = database.active;
const observable = db.get('threads').query(Q.where('tmid', tmid)).observe();
const observable = db.get('threads').query(Q.where('id', tmid)).observe();
subscription.current = observable.subscribe(result => {
setAlsoSendThreadToChannel(!result.length);
});