1
0
Fork 1
mirror of https://example.com synced 2024-11-22 11:16:38 +09:00

feat: add private visibility

This commit is contained in:
naskya 2023-10-15 14:46:40 +09:00
parent 46d0603fe9
commit 764e516a3c
Signed by: naskya
GPG key ID: 164DFF24E2D40139
9 changed files with 64 additions and 5 deletions

View file

@ -19,6 +19,8 @@
## 主要な変更点
- 「秘密」という公開範囲を追加
- 宛先無しのダイレクト投稿を言い換えているだけです
- パフォーマンス向上のためアクティブユーザー以外のチャート生成を無効化
- サードパーティー製クライアントが動かなくなるのを阻止するため API のエンドポイントは残していますが、叩いても `0` が並んだ配列しか返しません。
- モデレーターでない一般ユーザーにもカスタム絵文字の管理権を与えられるように

View file

@ -1710,6 +1710,8 @@ _visibility:
followersDescription: "Make visible to your followers and mentioned users only"
specified: "Direct"
specifiedDescription: "Make visible for specified users only"
private: "Private"
privateDescription: "Make visible for you only"
localOnly: "Local only"
localOnlyDescription: "Not visible to remote users"
_postForm:

View file

@ -1494,6 +1494,8 @@ _visibility:
followersDescription: "フォロワーと会話相手のみに公開"
specified: "ダイレクト"
specifiedDescription: "指定したユーザーのみに公開"
private: "秘密"
privateDescription: "あなた以外には非公開"
localOnly: "ローカルのみ"
localOnlyDescription: "リモートユーザーには非公開"
_postForm:

View file

@ -1395,6 +1395,8 @@ _visibility:
followersDescription: "仅对您的关注者和提及的用户可见"
specified: "指定用户"
specifiedDescription: "仅发送至指定用户"
private: "秘密"
privateDescription: "仅你可见"
localOnly: "仅限本地"
localOnlyDescription: "对远程用户不可见"
_postForm:

View file

@ -1390,6 +1390,8 @@ _visibility:
followersDescription: "僅發佈至關注者"
specified: "指定使用者"
specifiedDescription: "僅發送至指定使用者"
private: "祕密"
privateDescription: "僅你可見"
localOnly: "僅限本地"
localOnlyDescription: "對遠端使用者隱藏"
_postForm:

View file

@ -50,6 +50,9 @@
<span v-if="visibility === 'specified'"
><i class="ph-envelope-simple-open ph-bold ph-lg"></i
></span>
<span v-if="visibility === 'private'"
><i class="ph-eye-slash ph-bold ph-lg"></i
></span>
</button>
<button
v-tooltip="i18n.ts.previewNoteText"
@ -527,6 +530,8 @@ if (
}).then((users) => {
users.forEach(pushVisibleUser);
});
} else {
visibility.value = "private";
}
if (props.reply.userId !== $i.id) {
@ -885,9 +890,12 @@ async function post() {
poll: poll.value,
cw: useCw.value ? cw.value || "" : undefined,
localOnly: localOnly.value,
visibility: visibility.value,
visibility:
visibility.value === "private" ? "specified" : visibility.value,
visibleUserIds:
visibility.value === "specified"
visibility.value === "private"
? []
: visibility.value === "specified"
? visibleUsers.value.map((u) => u.id)
: undefined,
};

View file

@ -11,10 +11,19 @@
class="ph-lock ph-bold ph-lg"
></i>
<i
v-else-if="note.visibility === 'specified'"
v-else-if="
note.visibility === 'specified' &&
note.visibleUserIds.length > 0
"
ref="specified"
class="ph-envelope-simple-open ph-bold ph-lg"
></i>
<i
v-else-if="note.visibility === 'specified'"
v-tooltip="i18n.ts._visibility.private"
ref="specified"
class="ph-eye-slash ph-bold ph-lg"
></i>
</span>
<span v-if="note.localOnly" :class="$style.localOnly"
><i
@ -42,7 +51,10 @@ const props = defineProps<{
const specified = ref<HTMLElement>();
if (props.note.visibility === "specified") {
if (
props.note.visibility === "specified" &&
props.note.visibleUserIds.length > 0
) {
useTooltip(specified, async (showing) => {
const users = await os.api("users/show", {
userIds: props.note.visibleUserIds,

View file

@ -84,6 +84,25 @@
}}</span>
</div>
</button>
<button
key="private"
class="_button"
:class="[$style.item, { [$style.active]: v === 'private' }]"
data-index="5"
@click="choose('private')"
>
<div :class="$style.icon">
<i class="ph-eye-slash ph-bold ph-lg"></i>
</div>
<div :class="$style.body">
<span :class="$style.itemTitle">{{
i18n.ts._visibility.private
}}</span>
<span :class="$style.itemDescription">{{
i18n.ts._visibility.privateDescription
}}</span>
</div>
</button>
<div :class="$style.divider"></div>
<button
key="localOnly"
@ -154,7 +173,9 @@ watch(localOnly, () => {
emit("changeLocalOnly", localOnly.value);
});
function choose(visibility: (typeof firefish.noteVisibilities)[number]): void {
function choose(
visibility: (typeof firefish.noteVisibilities)[number] | "private",
): void {
v.value = visibility;
emit("changeVisibility", visibility);
nextTick(() => {

View file

@ -113,6 +113,11 @@
#suffix
>{{ i18n.ts._visibility.specified }}</template
>
<template
v-else-if="defaultNoteVisibility === 'private'"
#suffix
>{{ i18n.ts._visibility.private }}</template
>
<FormSelect v-model="defaultNoteVisibility" class="_formBlock">
<option value="public">
@ -125,6 +130,9 @@
<option value="specified">
{{ i18n.ts._visibility.specified }}
</option>
<option value="private">
{{ i18n.ts._visibility.private }}
</option>
</FormSelect>
<FormSwitch v-model="defaultNoteLocalOnly" class="_formBlock">{{
i18n.ts._visibility.localOnly