Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix:Searchfile/missinglocale #37

Merged
merged 11 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,9 @@ _achievements:
_setNameToNoriDev:
title: "神様コンプレックス(CherryPick)"
description: "名前を noridev に設定した"
_setNameToYojo:
title: "ロリータコンプレックス"
description: "名前を 幼女 に設定した"
_passedSinceAccountCreated1:
title: "一周年"
description: "アカウント作成から1年経過した"
Expand Down
7 changes: 7 additions & 0 deletions packages/backend/src/core/SearchService.ts
penginn-net marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ export class SearchService {
}
}

if (opts.fileOption) {
if (opts.fileOption === 'file-only') {
query.andWhere('note.fileIds != \'{}\'');
} else if (opts.fileOption === 'no-file') {
query.andWhere('note.fileIds = :fIds', { fIds: '{}' });
}
}
this.queryService.generateVisibilityQuery(query, me);
if (me) this.queryService.generateMutedUserQuery(query, me);
if (me) this.queryService.generateBlockedUserQuery(query, me);
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const ROLE_POLICIES = [
'canManageCustomEmojis',
'canManageAvatarDecorations',
'canSearchNotes',
'canAdvancedSearchNotes',
'canUseTranslator',
'canHideAds',
'driveCapacityMb',
Expand Down
10 changes: 9 additions & 1 deletion packages/frontend/src/pages/admin/roles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkSwitch>
</MkFolder>

<MkFolder v-if="matchQuery([i18n.ts._role._options.canUseTranslator, 'canSearchNotes'])">
<MkFolder v-if="matchQuery([i18n.ts._role._options.canAdvancedSearchNotes, 'canAdvancedSearchNotes'])">
<template #label>{{ i18n.ts._role._options.canAdvancedSearchNotes }}</template>
<template #suffix>{{ policies.canAdvancedSearchNotes ? i18n.ts.yes : i18n.ts.no }}</template>
<MkSwitch v-model="policies.canAdvancedSearchNotes">
<template #label>{{ i18n.ts.enable }}</template>
</MkSwitch>
</MkFolder>

<MkFolder v-if="matchQuery([i18n.ts._role._options.canUseTranslator, 'canUseTranslator'])">
<template #label>{{ i18n.ts._role._options.canUseTranslator }}</template>
<template #suffix>{{ policies.canUseTranslator ? i18n.ts.yes : i18n.ts.no }}</template>
<MkSwitch v-model="policies.canUseTranslator">
Expand Down
24 changes: 3 additions & 21 deletions packages/frontend/src/pages/search.note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,6 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
</MkFolder>
</div>
<div class="_gaps_m">
<MkFolder :defaultOpen="true">
<template #label>{{ i18n.ts.fileAttachedOnly }}</template>
<template v-if="isfileOnly" #suffix></template>

<div style="text-align: center;" class="_gaps">
<div>
<MkRadios v-model="isfileOnly" @update:modelValue="search()">
<option value="combined">{{ i18n.ts._advancedSearch._fileOption.combined }}</option>
<option value="file-only">{{ i18n.ts._advancedSearch._fileOption.fileAttachedOnly }}</option>
<option value="no-file">{{ i18n.ts._advancedSearch._fileOption.noFile }}</option>
</MkRadios>
</div>
</div>
</MkFolder>
</div>
</MkFolder>
<div>
<MkButton large primary gradate rounded style="margin: 0 auto;" @click="search">{{ i18n.ts.search }}</MkButton>
Expand Down Expand Up @@ -134,14 +118,12 @@ async function search() {
query: searchQuery.value,
userId: user.value ? user.value.id : null,
origin: searchOrigin.value,
fileOption: isfileOnly.value,
},
};

if(isfileOnly.value !== 'combined')
{
notePagination.value.endpoint = 'notes/search-file'
notePagination.value.params.fileOption = isfileOnly.value
if (isfileOnly.value !== 'combined') {
notePagination.value.endpoint = 'notes/search-file';
notePagination.value.params.fileOption = isfileOnly.value;
}
if (isLocalOnly.value) notePagination.value.params.host = '.';

Expand Down
Loading