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(frontend): 下書き/削除して編集で保持されない項目があった問題を修正 #14285

Merged
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
- Fix: 子メニューの高さがウィンドウからはみ出ることがある問題を修正
- Fix: 個人宛てのダイアログ形式のお知らせが即時表示されない問題を修正
- Fix: 一部の画像がセンシティブ指定されているときに画面に何も表示されないことがあるのを修正
- Fix: ダイレクト投稿の"削除して編集"において、宛先が保持されていなかった問題を修正
- Fix: 投稿フォームへのURL貼り付けによる引用が下書きに保存されていなかった問題を修正
- Fix: "削除して編集"や下書きにおいて、リアクションの受け入れ設定が保持/保存されていなかった問題を修正

### Server
- Feat: レートリミット制限に引っかかったときに`Retry-After`ヘッダーを返すように (#13949)
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/models/json-schema/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export const packedNoteSchema = {
reactionAcceptance: {
type: 'string',
optional: false, nullable: true,
enum: ['likeOnly', 'likeOnlyForRemote', 'nonSensitiveOnly', 'nonSensitiveOnlyForLocalLikeOnlyForRemote'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ややこしいんですがここに null を加えないと自動生成の型が nullable でなくなってしまいます

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullableだけじゃ不足なのですね…なるほど

},
reactionEmojis: {
type: 'object',
Expand Down
20 changes: 16 additions & 4 deletions packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ function watchForDraft() {
watch(files, () => saveDraft(), { deep: true });
watch(visibility, () => saveDraft());
watch(localOnly, () => saveDraft());
watch(quoteId, () => saveDraft());
watch(reactionAcceptance, () => saveDraft());
}

function checkMissingMention() {
Expand Down Expand Up @@ -703,6 +705,8 @@ function saveDraft() {
files: files.value,
poll: poll.value,
visibleUserIds: visibility.value === 'specified' ? visibleUsers.value.map(x => x.id) : undefined,
quoteId: quoteId.value,
reactionAcceptance: reactionAcceptance.value,
},
};

Expand Down Expand Up @@ -991,16 +995,20 @@ onMounted(() => {
users.forEach(u => pushVisibleUser(u));
});
}
quoteId.value = draft.data.quoteId;
reactionAcceptance.value = draft.data.reactionAcceptance;
}
}

// 削除して編集
if (props.initialNote) {
const init = props.initialNote;
text.value = init.text ? init.text : '';
files.value = init.files ?? [];
cw.value = init.cw ?? null;
useCw.value = init.cw != null;
cw.value = init.cw ?? null;
visibility.value = init.visibility;
localOnly.value = init.localOnly ?? false;
files.value = init.files ?? [];
if (init.poll) {
poll.value = {
choices: init.poll.choices.map(x => x.text),
Expand All @@ -1009,9 +1017,13 @@ onMounted(() => {
expiredAfter: null,
};
}
visibility.value = init.visibility;
localOnly.value = init.localOnly ?? false;
if (init.visibleUserIds) {
misskeyApi('users/show', { userIds: init.visibleUserIds }).then(users => {
users.forEach(u => pushVisibleUser(u));
});
}
quoteId.value = init.renote ? init.renote.id : null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

削除して編集でのquoteIdは要らない気がしています。
というのも、返信先や引用先の情報は他で持っているようなので、quoteIdも扱うと画像のように余分な"引用付き"表示が出てしまうためです。(画像は引用付きのリプライを"削除して編集"している様子)
image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(なお、あったとしてもrenoteIdの方が優先されるように書かれていたはずなので、問題は起きていません)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#14476 より、逆にrenoteIdを外した方が良さそうですね

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#14476 は×ボタンで解除したにもかかわらず解除できていないのを問題とする内容なので、renoteId/quoteIdの話ではないかも…

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いえ、その×ボタンはquoteIdで発生するやつなので…
renoteIdとquoteIdを両方詰めているから、quoteIdだけ消えてもダメという状態です

reactionAcceptance.value = init.reactionAcceptance;
}

nextTick(() => watchForDraft());
Expand Down
3 changes: 2 additions & 1 deletion packages/misskey-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4089,7 +4089,8 @@ export type components = {
userId: string | null;
}) | null;
localOnly?: boolean;
reactionAcceptance: string | null;
/** @enum {string|null} */
reactionAcceptance: 'likeOnly' | 'likeOnlyForRemote' | 'nonSensitiveOnly' | 'nonSensitiveOnlyForLocalLikeOnlyForRemote';
reactionEmojis: {
[key: string]: string;
};
Expand Down
Loading