Improve global search
Add options to show only searches for - pinned sources - all sources - sources with results
This commit is contained in:
@@ -80,7 +80,8 @@ export class Sources {
|
||||
showNsfw,
|
||||
languages,
|
||||
keepLocalSource,
|
||||
}: { showNsfw?: boolean; languages?: string[]; keepLocalSource?: boolean } = {},
|
||||
pinned,
|
||||
}: { showNsfw?: boolean; languages?: string[]; keepLocalSource?: boolean; pinned?: boolean } = {},
|
||||
): Source[] {
|
||||
const normalizedLanguages = toComparableLanguages(toUniqueLanguageCodes(languages ?? []));
|
||||
|
||||
@@ -97,6 +98,13 @@ export class Sources {
|
||||
!languages ||
|
||||
normalizedLanguages.includes(toComparableLanguage(Sources.getLanguage(source))) ||
|
||||
(keepLocalSource && Sources.isLocalSource(source)),
|
||||
)
|
||||
.filter(
|
||||
(source) =>
|
||||
pinned === undefined ||
|
||||
!pinned ||
|
||||
getSourceMetadata(source).isPinned ||
|
||||
(keepLocalSource && Sources.isLocalSource(source)),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user