Fix thread messages grey

This commit is contained in:
Diego Mello 2022-11-29 16:43:25 -03:00
parent de6a897ec4
commit a593129a3c
2 changed files with 9 additions and 7 deletions

View File

@ -133,6 +133,8 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
hideSystemMessages = []; hideSystemMessages = [];
} }
const columnsToObserve = ['_updated_at', 'status'];
if (tmid) { if (tmid) {
try { try {
this.thread = await db.get('threads').find(tmid); this.thread = await db.get('threads').find(tmid);
@ -142,7 +144,7 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
this.messagesObservable = db this.messagesObservable = db
.get('thread_messages') .get('thread_messages')
.query(Q.where('rid', tmid), Q.experimentalSortBy('ts', Q.desc), Q.experimentalSkip(0), Q.experimentalTake(this.count)) .query(Q.where('rid', tmid), Q.experimentalSortBy('ts', Q.desc), Q.experimentalSkip(0), Q.experimentalTake(this.count))
.observeWithColumns(['_updated_at']); .observeWithColumns(columnsToObserve);
} else if (rid) { } else if (rid) {
const whereClause = [ const whereClause = [
Q.where('rid', rid), Q.where('rid', rid),
@ -156,7 +158,7 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
this.messagesObservable = db this.messagesObservable = db
.get('messages') .get('messages')
.query(...whereClause) .query(...whereClause)
.observeWithColumns(['_updated_at', 'status']); .observeWithColumns(columnsToObserve);
} }
if (rid) { if (rid) {
@ -171,7 +173,7 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
}); });
if (tmid && this.thread) { if (tmid && this.thread) {
data = [...messages, this.thread]; data = [...messages, this.thread.asPlain()];
} }
/** /**
@ -347,7 +349,7 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
scrollEventThrottle={16} scrollEventThrottle={16}
listRef={listRef} listRef={listRef}
data={messages} data={messages}
extraData={loading} extraData={loading || messages}
// @ts-ignore // @ts-ignore
renderItem={this.renderItem} renderItem={this.renderItem}
onEndReached={this.onEndReached} onEndReached={this.onEndReached}

View File

@ -393,7 +393,7 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
let observable; let observable;
const defaultWhereClause = [Q.where('archived', false), Q.where('open', true)] as (Q.WhereDescription | Q.SortBy)[]; const defaultWhereClause = [Q.where('archived', false), Q.where('open', true)] as (Q.WhereDescription | Q.SortBy)[];
const observeColumns = ['alert', 'f', 'on_hold', 'room_updated_at']; const columnsToObserve = ['alert', 'f', 'on_hold', 'room_updated_at'];
if (sortBy === SortBy.Alphabetical) { if (sortBy === SortBy.Alphabetical) {
defaultWhereClause.push(Q.experimentalSortBy(`${this.useRealName ? 'fname' : 'name'}`, Q.asc)); defaultWhereClause.push(Q.experimentalSortBy(`${this.useRealName ? 'fname' : 'name'}`, Q.asc));
@ -406,14 +406,14 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
observable = await db observable = await db
.get('subscriptions') .get('subscriptions')
.query(...defaultWhereClause) .query(...defaultWhereClause)
.observeWithColumns(observeColumns); .observeWithColumns(columnsToObserve);
// When we're NOT grouping // When we're NOT grouping
} else { } else {
this.count += QUERY_SIZE; this.count += QUERY_SIZE;
observable = await db observable = await db
.get('subscriptions') .get('subscriptions')
.query(...defaultWhereClause, Q.experimentalSkip(0), Q.experimentalTake(this.count)) .query(...defaultWhereClause, Q.experimentalSkip(0), Q.experimentalTake(this.count))
.observeWithColumns(observeColumns); .observeWithColumns(columnsToObserve);
} }
this.querySubscription = observable.subscribe(data => { this.querySubscription = observable.subscribe(data => {