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>;
|
||||
draftBodyRanges?: DraftBodyRanges;
|
||||
draftTimestamp?: number | null;
|
||||
hiddenFromConversationSearch?: boolean;
|
||||
hideStory?: boolean;
|
||||
inbox_position?: number;
|
||||
// When contact is removed - it is initially placed into `justNotification`
|
||||
|
|
|
@ -407,8 +407,6 @@ export class ConversationModel extends window.Backbone
|
|||
this.unset('tokens');
|
||||
|
||||
this.on('change:members change:membersV2', this.fetchContacts);
|
||||
this.on('change:active_at', this.onActiveAtChange);
|
||||
|
||||
this.typingRefreshTimer = 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> {
|
||||
if (!isGroupV2(this.attributes)) {
|
||||
return;
|
||||
|
@ -4854,12 +4846,7 @@ export class ConversationModel extends window.Backbone
|
|||
ourAci
|
||||
);
|
||||
const sharedGroups = ourGroups
|
||||
.filter(
|
||||
c =>
|
||||
c.hasMember(ourAci) &&
|
||||
c.hasMember(theirAci) &&
|
||||
!c.attributes.hiddenFromConversationSearch
|
||||
)
|
||||
.filter(c => c.hasMember(ourAci) && c.hasMember(theirAci))
|
||||
.sort(
|
||||
(left, right) =>
|
||||
(right.get('timestamp') || 0) - (left.get('timestamp') || 0)
|
||||
|
@ -5222,9 +5209,6 @@ export class ConversationModel extends window.Backbone
|
|||
active_at: null,
|
||||
pendingUniversalTimer: undefined,
|
||||
});
|
||||
if (isGroup(this.attributes)) {
|
||||
this.set('hiddenFromConversationSearch', true);
|
||||
}
|
||||
await DataWriter.updateConversation(this.attributes);
|
||||
|
||||
const ourConversation =
|
||||
|
|
|
@ -296,7 +296,6 @@ export type ConversationType = ReadonlyDeep<
|
|||
customColor?: CustomColorType;
|
||||
customColorId?: string;
|
||||
discoveredUnregisteredAt?: number;
|
||||
hiddenFromConversationSearch?: boolean;
|
||||
hideStory?: boolean;
|
||||
isArchived?: boolean;
|
||||
isBlocked?: boolean;
|
||||
|
|
|
@ -352,11 +352,14 @@ async function queryConversationsAndContacts(
|
|||
|
||||
const normalizedQuery = removeDiacritics(query);
|
||||
|
||||
const visibleConversations = allConversations.filter(
|
||||
({ activeAt, removalStage }) => {
|
||||
const visibleConversations = allConversations.filter(conversation => {
|
||||
const { activeAt, removalStage } = conversation;
|
||||
if (isDirectConversation(conversation)) {
|
||||
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(
|
||||
visibleConversations,
|
||||
|
|
|
@ -589,8 +589,7 @@ export const getAllComposableConversations = createSelector(
|
|||
// 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.
|
||||
conversation.titleNoDefault &&
|
||||
hasDisplayInfo(conversation) &&
|
||||
!conversation.hiddenFromConversationSearch
|
||||
hasDisplayInfo(conversation)
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ export function filterAndSortConversations(
|
|||
const withoutUnknown = conversations.filter(item => item.titleNoDefault);
|
||||
|
||||
return searchConversations(withoutUnknown, searchTerm, regionCode)
|
||||
.filter(({ item }) => !item.hiddenFromConversationSearch)
|
||||
.slice()
|
||||
.sort((a, b) => {
|
||||
const { activeAt: aActiveAt = 0, left: aLeft = false } = a.item;
|
||||
const { activeAt: bActiveAt = 0, left: bLeft = false } = b.item;
|
||||
|
|
|
@ -175,9 +175,6 @@ export function getConversation(model: ConversationModel): ConversationType {
|
|||
groupVersion,
|
||||
groupId: attributes.groupId,
|
||||
groupLink: buildGroupLink(attributes),
|
||||
hiddenFromConversationSearch: Boolean(
|
||||
attributes.hiddenFromConversationSearch
|
||||
),
|
||||
hideStory: Boolean(attributes.hideStory),
|
||||
inboxPosition,
|
||||
isArchived: attributes.isArchived,
|
||||
|
|
Loading…
Reference in a new issue