fix: fixes the behavior of the alsoSendThreadToChannel property (#5573)
This commit is contained in:
parent
e55b172bc1
commit
1beb0d0efa
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue