Remove old changes from ThreadMessagesView
This commit is contained in:
parent
9ad45f067c
commit
fc59b7426c
|
@ -55,9 +55,6 @@ class ThreadMessagesView extends React.Component {
|
|||
this.mounted = false;
|
||||
this.rid = props.route.params?.rid;
|
||||
this.t = props.route.params?.t;
|
||||
this.name = props.route.params?.name;
|
||||
this.isDiscussion = props.route.params?.isDiscussion;
|
||||
this.prid = props.route.params?.prid;
|
||||
this.state = {
|
||||
loading: false,
|
||||
end: false,
|
||||
|
@ -134,7 +131,7 @@ class ThreadMessagesView extends React.Component {
|
|||
/>
|
||||
),
|
||||
headerTitleAlign: 'center',
|
||||
headerTitle: this.isDiscussion ? this.name : I18n.t('Threads'),
|
||||
headerTitle: I18n.t('Threads'),
|
||||
headerTitleContainerStyle: {
|
||||
left: null,
|
||||
right: null
|
||||
|
@ -299,33 +296,20 @@ class ThreadMessagesView extends React.Component {
|
|||
|
||||
this.setState({ loading: true });
|
||||
|
||||
if (this.isDiscussion) {
|
||||
try {
|
||||
const db = database.active;
|
||||
const subCollection = db.get('subscriptions');
|
||||
const discussions = await subCollection.query(
|
||||
Q.where('prid', Q.eq(this.prid))
|
||||
);
|
||||
this.setState({ loading: false, displayingThreads: discussions });
|
||||
} catch (e) {
|
||||
log(e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
const result = await RocketChat.getThreadsList({
|
||||
rid: this.rid, count: API_FETCH_COUNT, offset: messages.length, text: searchText
|
||||
try {
|
||||
const result = await RocketChat.getThreadsList({
|
||||
rid: this.rid, count: API_FETCH_COUNT, offset: messages.length, text: searchText
|
||||
});
|
||||
if (result.success) {
|
||||
this.updateThreads({ update: result.threads, lastThreadSync });
|
||||
this.setState({
|
||||
loading: false,
|
||||
end: result.count < API_FETCH_COUNT
|
||||
});
|
||||
if (result.success) {
|
||||
this.updateThreads({ update: result.threads, lastThreadSync });
|
||||
this.setState({
|
||||
loading: false,
|
||||
end: result.count < API_FETCH_COUNT
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
log(e);
|
||||
this.setState({ loading: false, end: true });
|
||||
}
|
||||
} catch (e) {
|
||||
log(e);
|
||||
this.setState({ loading: false, end: true });
|
||||
}
|
||||
}, 300)
|
||||
|
||||
|
@ -450,7 +434,7 @@ class ThreadMessagesView extends React.Component {
|
|||
|
||||
renderHeader = () => {
|
||||
const { messages, currentFilter } = this.state;
|
||||
if (!messages.length || this.isDiscussion) {
|
||||
if (!messages.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -474,7 +458,7 @@ class ThreadMessagesView extends React.Component {
|
|||
} else if (currentFilter === FILTER.UNREAD) {
|
||||
text = I18n.t('No_threads_unread');
|
||||
} else {
|
||||
text = this.isDiscussion ? I18n.t('No_discussions') : I18n.t('No_threads');
|
||||
text = I18n.t('No_threads');
|
||||
}
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Reference in New Issue