Fix group search visibility
This commit is contained in:
parent
0e5d6ddd68
commit
35946ef53c
7 changed files with 9 additions and 28 deletions
1
ts/model-types.d.ts
vendored
1
ts/model-types.d.ts
vendored
|
@ -354,7 +354,6 @@ export type ConversationAttributesType = {
|
||||||
draftAttachments?: ReadonlyArray<AttachmentDraftType>;
|
draftAttachments?: ReadonlyArray<AttachmentDraftType>;
|
||||||
draftBodyRanges?: DraftBodyRanges;
|
draftBodyRanges?: DraftBodyRanges;
|
||||||
draftTimestamp?: number | null;
|
draftTimestamp?: number | null;
|
||||||
hiddenFromConversationSearch?: boolean;
|
|
||||||
hideStory?: boolean;
|
hideStory?: boolean;
|
||||||
inbox_position?: number;
|
inbox_position?: number;
|
||||||
// When contact is removed - it is initially placed into `justNotification`
|
// When contact is removed - it is initially placed into `justNotification`
|
||||||
|
|
|
@ -407,8 +407,6 @@ export class ConversationModel extends window.Backbone
|
||||||
this.unset('tokens');
|
this.unset('tokens');
|
||||||
|
|
||||||
this.on('change:members change:membersV2', this.fetchContacts);
|
this.on('change:members change:membersV2', this.fetchContacts);
|
||||||
this.on('change:active_at', this.onActiveAtChange);
|
|
||||||
|
|
||||||
this.typingRefreshTimer = null;
|
this.typingRefreshTimer = null;
|
||||||
this.typingPauseTimer = null;
|
this.typingPauseTimer = null;
|
||||||
|
|
||||||
|
@ -4418,12 +4416,6 @@ export class ConversationModel extends window.Backbone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onActiveAtChange(): void {
|
|
||||||
if (this.get('active_at') && this.get('hiddenFromConversationSearch')) {
|
|
||||||
this.set('hiddenFromConversationSearch', false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async refreshGroupLink(): Promise<void> {
|
async refreshGroupLink(): Promise<void> {
|
||||||
if (!isGroupV2(this.attributes)) {
|
if (!isGroupV2(this.attributes)) {
|
||||||
return;
|
return;
|
||||||
|
@ -4854,12 +4846,7 @@ export class ConversationModel extends window.Backbone
|
||||||
ourAci
|
ourAci
|
||||||
);
|
);
|
||||||
const sharedGroups = ourGroups
|
const sharedGroups = ourGroups
|
||||||
.filter(
|
.filter(c => c.hasMember(ourAci) && c.hasMember(theirAci))
|
||||||
c =>
|
|
||||||
c.hasMember(ourAci) &&
|
|
||||||
c.hasMember(theirAci) &&
|
|
||||||
!c.attributes.hiddenFromConversationSearch
|
|
||||||
)
|
|
||||||
.sort(
|
.sort(
|
||||||
(left, right) =>
|
(left, right) =>
|
||||||
(right.get('timestamp') || 0) - (left.get('timestamp') || 0)
|
(right.get('timestamp') || 0) - (left.get('timestamp') || 0)
|
||||||
|
@ -5222,9 +5209,6 @@ export class ConversationModel extends window.Backbone
|
||||||
active_at: null,
|
active_at: null,
|
||||||
pendingUniversalTimer: undefined,
|
pendingUniversalTimer: undefined,
|
||||||
});
|
});
|
||||||
if (isGroup(this.attributes)) {
|
|
||||||
this.set('hiddenFromConversationSearch', true);
|
|
||||||
}
|
|
||||||
await DataWriter.updateConversation(this.attributes);
|
await DataWriter.updateConversation(this.attributes);
|
||||||
|
|
||||||
const ourConversation =
|
const ourConversation =
|
||||||
|
|
|
@ -296,7 +296,6 @@ export type ConversationType = ReadonlyDeep<
|
||||||
customColor?: CustomColorType;
|
customColor?: CustomColorType;
|
||||||
customColorId?: string;
|
customColorId?: string;
|
||||||
discoveredUnregisteredAt?: number;
|
discoveredUnregisteredAt?: number;
|
||||||
hiddenFromConversationSearch?: boolean;
|
|
||||||
hideStory?: boolean;
|
hideStory?: boolean;
|
||||||
isArchived?: boolean;
|
isArchived?: boolean;
|
||||||
isBlocked?: boolean;
|
isBlocked?: boolean;
|
||||||
|
|
|
@ -352,11 +352,14 @@ async function queryConversationsAndContacts(
|
||||||
|
|
||||||
const normalizedQuery = removeDiacritics(query);
|
const normalizedQuery = removeDiacritics(query);
|
||||||
|
|
||||||
const visibleConversations = allConversations.filter(
|
const visibleConversations = allConversations.filter(conversation => {
|
||||||
({ activeAt, removalStage }) => {
|
const { activeAt, removalStage } = conversation;
|
||||||
|
if (isDirectConversation(conversation)) {
|
||||||
return activeAt != null || removalStage == null;
|
return activeAt != null || removalStage == null;
|
||||||
}
|
}
|
||||||
);
|
// We don't show groups in search results that don't have any messages
|
||||||
|
return activeAt != null;
|
||||||
|
});
|
||||||
|
|
||||||
const searchResults: Array<ConversationType> = filterAndSortConversations(
|
const searchResults: Array<ConversationType> = filterAndSortConversations(
|
||||||
visibleConversations,
|
visibleConversations,
|
||||||
|
|
|
@ -589,8 +589,7 @@ export const getAllComposableConversations = createSelector(
|
||||||
// All conversation should have a title except in weird cases where
|
// All conversation should have a title except in weird cases where
|
||||||
// they don't, in that case we don't want to show these for Forwarding.
|
// they don't, in that case we don't want to show these for Forwarding.
|
||||||
conversation.titleNoDefault &&
|
conversation.titleNoDefault &&
|
||||||
hasDisplayInfo(conversation) &&
|
hasDisplayInfo(conversation)
|
||||||
!conversation.hiddenFromConversationSearch
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ export function filterAndSortConversations(
|
||||||
const withoutUnknown = conversations.filter(item => item.titleNoDefault);
|
const withoutUnknown = conversations.filter(item => item.titleNoDefault);
|
||||||
|
|
||||||
return searchConversations(withoutUnknown, searchTerm, regionCode)
|
return searchConversations(withoutUnknown, searchTerm, regionCode)
|
||||||
.filter(({ item }) => !item.hiddenFromConversationSearch)
|
.slice()
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
const { activeAt: aActiveAt = 0, left: aLeft = false } = a.item;
|
const { activeAt: aActiveAt = 0, left: aLeft = false } = a.item;
|
||||||
const { activeAt: bActiveAt = 0, left: bLeft = false } = b.item;
|
const { activeAt: bActiveAt = 0, left: bLeft = false } = b.item;
|
||||||
|
|
|
@ -175,9 +175,6 @@ export function getConversation(model: ConversationModel): ConversationType {
|
||||||
groupVersion,
|
groupVersion,
|
||||||
groupId: attributes.groupId,
|
groupId: attributes.groupId,
|
||||||
groupLink: buildGroupLink(attributes),
|
groupLink: buildGroupLink(attributes),
|
||||||
hiddenFromConversationSearch: Boolean(
|
|
||||||
attributes.hiddenFromConversationSearch
|
|
||||||
),
|
|
||||||
hideStory: Boolean(attributes.hideStory),
|
hideStory: Boolean(attributes.hideStory),
|
||||||
inboxPosition,
|
inboxPosition,
|
||||||
isArchived: attributes.isArchived,
|
isArchived: attributes.isArchived,
|
||||||
|
|
Loading…
Reference in a new issue