Merge pull request #2157 from Bilb/mentions-quicker-load-convo-change

fetch last active users quicker on convo changes to public convo
pull/2158/head
Audric Ackermann 3 years ago committed by GitHub
commit 036d3827ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -123,7 +123,7 @@ export class SessionConversation extends React.Component<Props, State> {
// if the newConversation changed, and is public, start our refresh members list
if (newConversation.isPublic) {
// this is a debounced call.
void this.updateMemberList();
void this.updateMemberListBouncy();
// run this only once every minute if we don't change the visible conversation.
// this is a heavy operation (like a few thousands members can be here)
this.publicMembersRefreshTimeout = global.setInterval(this.updateMemberList, 60000);

@ -14,7 +14,7 @@ import {
} from '../SessionStagedLinkPreview';
import { AbortController } from 'abort-controller';
import { SessionQuotedMessageComposition } from '../SessionQuotedMessageComposition';
import { Mention, MentionsInput } from 'react-mentions';
import { Mention, MentionsInput, SuggestionDataItem } from 'react-mentions';
import { MemberListItem } from '../../MemberListItem';
import autoBind from 'auto-bind';
import { getMediaPermissionsSettings } from '../../settings/SessionSettings';
@ -467,7 +467,10 @@ class CompositionBoxInner extends React.Component<Props, State> {
);
}
private fetchUsersForOpenGroup(query: any, callback: any) {
private fetchUsersForOpenGroup(
query: string,
callback: (data: Array<SuggestionDataItem>) => void
) {
const mentionsInput = getMentionsInput(window?.inboxStore?.getState() || []);
const filtered =
mentionsInput
@ -481,10 +484,11 @@ class CompositionBoxInner extends React.Component<Props, State> {
id: user.id,
};
}) || [];
callback(filtered);
}
private fetchUsersForGroup(query: any, callback: any) {
private fetchUsersForGroup(query: string, callback: (data: Array<SuggestionDataItem>) => void) {
let overridenQuery = query;
if (!query) {
overridenQuery = '';

@ -1012,18 +1012,14 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
window.storage.get(SettingsKey.settingsReadReceipt) || false
);
if (window.storage.get(SettingsKey.settingsReadReceipt)) {
await Promise.all(
_.map(_.groupBy(read, 'sender'), async (receipts, sender) => {
const timestamps = _.map(receipts, 'timestamp').filter(t => !!t) as Array<number>;
const receiptMessage = new ReadReceiptMessage({
timestamp: Date.now(),
timestamps,
});
const device = new PubKey(sender);
await getMessageQueue().sendToPubKey(device, receiptMessage);
})
);
const timestamps = _.map(read, 'timestamp').filter(t => !!t) as Array<number>;
const receiptMessage = new ReadReceiptMessage({
timestamp: Date.now(),
timestamps,
});
const device = new PubKey(this.id);
await getMessageQueue().sendToPubKey(device, receiptMessage);
}
}
}

Loading…
Cancel
Save