Skip to content

Commit

Permalink
下書き機能が利用できない場合は表示しないように
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih committed Jan 17, 2025
1 parent 253c8fd commit 099c2c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-tooltip="i18n.ts.hashtags" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: withHashtags }]" @click="withHashtags = !withHashtags"><i class="ti ti-hash"></i></button>
<button v-if="postFormActions.length > 0" v-tooltip="i18n.ts.plugins" class="_button" :class="$style.footerButton" @click="showActions"><i class="ti ti-plug"></i></button>
<button v-tooltip="i18n.ts.emoji" :class="['_button', $style.footerButton]" @click="insertEmoji"><i class="ti ti-mood-happy"></i></button>
<button v-tooltip="(postAccount != null && postAccount.id !== $i.id) ? null : i18n.ts.draft" class="_button" :class="$style.footerButton" :disabled="postAccount != null && postAccount.id !== $i.id" @click="showDraftMenu"><i class="ti ti-pencil-minus"></i></button>
<button v-if="serverNoteDraftAvailable" v-tooltip="(postAccount != null && postAccount.id !== $i.id) ? null : i18n.ts.draft" class="_button" :class="$style.footerButton" :disabled="postAccount != null && postAccount.id !== $i.id" @click="showDraftMenu"><i class="ti ti-pencil-minus"></i></button>
<button v-if="showAddMfmFunction" v-tooltip="i18n.ts.addMfmFunction" :class="['_button', $style.footerButton]" @click="insertMfmFunction"><i class="ti ti-palette"></i></button>
</div>
<div :class="$style.footerRight">
Expand Down Expand Up @@ -131,6 +131,7 @@ import { miLocalStorage } from '@/local-storage.js';
import { claimAchievement } from '@/scripts/achievements.js';
import { emojiPicker } from '@/scripts/emoji-picker.js';
import { mfmFunctionPicker } from '@/scripts/mfm-function-picker.js';
import { serverNoteDraftAvailable } from '@/scripts/check-permissions.js';

const $i = signinRequired();

Expand Down
8 changes: 8 additions & 0 deletions packages/frontend/src/scripts/check-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@ export const notesSearchAvailable = (
export const canSearchNonLocalNotes = (
instance.noteSearchableScope === 'global'
);

export const serverNoteDraftAvailable = (
// FIXME: instance.policies would be null in Vitest
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
($i == null && instance.policies != null && instance.policies.noteDraftLimit > 0) ||
($i != null && $i.policies.noteDraftLimit > 0) ||
false
);

0 comments on commit 099c2c9

Please sign in to comment.