fix: enables navigation for deleted threads (#5317)
* fix navigation to deleted thread * fxi threads without name * fix thread name
This commit is contained in:
parent
16347b0bb6
commit
74e500a4bb
|
@ -397,6 +397,7 @@
|
||||||
"This_room_is_blocked": "This room is blocked",
|
"This_room_is_blocked": "This room is blocked",
|
||||||
"This_room_is_read_only": "This room is read only",
|
"This_room_is_read_only": "This room is read only",
|
||||||
"Threads": "Threads",
|
"Threads": "Threads",
|
||||||
|
"Thread": "Thread",
|
||||||
"Timezone": "Timezone",
|
"Timezone": "Timezone",
|
||||||
"topic": "topic",
|
"topic": "topic",
|
||||||
"Topic": "Topic",
|
"Topic": "Topic",
|
||||||
|
|
|
@ -94,6 +94,7 @@ import { withActionSheet, IActionSheetProvider } from '../../containers/ActionSh
|
||||||
import { goRoom, TGoRoomItem } from '../../lib/methods/helpers/goRoom';
|
import { goRoom, TGoRoomItem } from '../../lib/methods/helpers/goRoom';
|
||||||
import audioPlayer from '../../lib/methods/audioPlayer';
|
import audioPlayer from '../../lib/methods/audioPlayer';
|
||||||
import { IListContainerRef, TListRef } from './List/definitions';
|
import { IListContainerRef, TListRef } from './List/definitions';
|
||||||
|
import { getThreadById } from '../../lib/database/services/Thread';
|
||||||
|
|
||||||
type TStateAttrsUpdate = keyof IRoomViewState;
|
type TStateAttrsUpdate = keyof IRoomViewState;
|
||||||
|
|
||||||
|
@ -1128,6 +1129,15 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
|
||||||
return getThreadName(rid, tmid, messageId);
|
return getThreadName(rid, tmid, messageId);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fetchThreadName = async (tmid: string, messageId: string) => {
|
||||||
|
const { rid } = this.state.room;
|
||||||
|
const threadRecord = await getThreadById(tmid);
|
||||||
|
if (threadRecord?.t === 'rm') {
|
||||||
|
return I18n.t('Message_removed');
|
||||||
|
}
|
||||||
|
return getThreadName(rid, tmid, messageId);
|
||||||
|
};
|
||||||
|
|
||||||
toggleFollowThread = async (isFollowingThread: boolean, tmid?: string) => {
|
toggleFollowThread = async (isFollowingThread: boolean, tmid?: string) => {
|
||||||
try {
|
try {
|
||||||
const threadMessageId = tmid ?? this.tmid;
|
const threadMessageId = tmid ?? this.tmid;
|
||||||
|
@ -1177,6 +1187,10 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
|
||||||
jumpToMessageId = item.id;
|
jumpToMessageId = item.id;
|
||||||
}
|
}
|
||||||
sendLoadingEvent({ visible: true, onCancel: this.cancelJumpToMessage });
|
sendLoadingEvent({ visible: true, onCancel: this.cancelJumpToMessage });
|
||||||
|
const threadRecord = await getThreadById(item.tmid);
|
||||||
|
if (threadRecord?.t === 'rm') {
|
||||||
|
name = I18n.t('Thread');
|
||||||
|
}
|
||||||
if (!name) {
|
if (!name) {
|
||||||
const result = await this.getThreadName(item.tmid, jumpToMessageId);
|
const result = await this.getThreadName(item.tmid, jumpToMessageId);
|
||||||
// test if there isn't a thread
|
// test if there isn't a thread
|
||||||
|
@ -1335,7 +1349,7 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
|
||||||
isThreadRoom={!!this.tmid}
|
isThreadRoom={!!this.tmid}
|
||||||
isIgnored={this.isIgnored(item)}
|
isIgnored={this.isIgnored(item)}
|
||||||
previousItem={previousItem}
|
previousItem={previousItem}
|
||||||
fetchThreadName={this.getThreadName}
|
fetchThreadName={this.fetchThreadName}
|
||||||
onReactionPress={this.onReactionPress}
|
onReactionPress={this.onReactionPress}
|
||||||
onReactionLongPress={this.onReactionLongPress}
|
onReactionLongPress={this.onReactionLongPress}
|
||||||
onLongPress={this.onMessageLongPress}
|
onLongPress={this.onMessageLongPress}
|
||||||
|
|
Loading…
Reference in New Issue