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

View File

@ -51,8 +51,7 @@ export const SendThreadToChannel = (): React.ReactElement | null => {
* */ * */
if (alsoSendThreadToChannelUserPref === 'default') { if (alsoSendThreadToChannelUserPref === 'default') {
const db = database.active; 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 => { subscription.current = observable.subscribe(result => {
setAlsoSendThreadToChannel(!result.length); setAlsoSendThreadToChannel(!result.length);
}); });