Skip to content

Commit

Permalink
ノートを編集する時に検索許可範囲を記憶する (#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
kozakura913 authored Nov 29, 2024
1 parent a037a66 commit f918b11
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG_YOJO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## 1.2.0
### General
- Fix: ノートを編集する時に検索許可範囲を記憶する [#558](https://github.com/yojo-art/cherrypick/pull/558)

### Server
- Enhance: `/users/${id}``Accept: application/ld+json`ではないリクエストが来たとき`/@${username}`にリダイレクトするように [#554](https://github.com/yojo-art/cherrypick/pull/554)
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/core/WebhookTestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ function toPackedNote(note: MiNote, detail = true, override?: Packed<'Note'>): P
renoteId: note.renoteId,
isHidden: false,
visibility: note.visibility,
searchableBy: note.searchableBy,
mentions: note.mentions,
visibleUserIds: note.visibleUserIds,
fileIds: note.fileIds,
Expand Down
5 changes: 5 additions & 0 deletions packages/backend/src/models/json-schema/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ export const packedNoteSchema = {
optional: false, nullable: false,
enum: ['public', 'home', 'followers', 'specified'],
},
searchableBy: {
type: 'string',
optional: false, nullable: true,
enum: ['public', 'private', 'followersAndReacted', 'reactedOnly'],
},
mentions: {
type: 'array',
optional: true, nullable: false,
Expand Down
2 changes: 2 additions & 0 deletions packages/cherrypick-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4456,6 +4456,8 @@ export type components = {
isHidden?: boolean;
/** @enum {string} */
visibility: 'public' | 'home' | 'followers' | 'specified';
/** @enum {string|null} */
searchableBy: 'public' | 'private' | 'followersAndReacted' | 'reactedOnly';
mentions?: string[];
visibleUserIds?: string[];
fileIds?: string[];
Expand Down
5 changes: 4 additions & 1 deletion packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ function watchForDraft() {
watch(event, () => saveDraft());
watch(files, () => saveDraft(), { deep: true });
watch(visibility, () => saveDraft());
watch(searchableBy, () => saveDraft());
watch(quoteId, () => saveDraft());
watch(reactionAcceptance, () => saveDraft());
watch(scheduledNoteDelete, () => saveDraft());
Expand Down Expand Up @@ -742,6 +743,7 @@ function saveDraft() {
cw: cw.value,
disableRightClick: disableRightClick.value,
visibility: visibility.value,
searchableBy: searchableBy.value,
files: files.value,
poll: poll.value,
event: event.value,
Expand Down Expand Up @@ -1166,7 +1168,7 @@ onMounted(() => {
cw.value = draft.data.cw;
disableRightClick.value = draft.data.disableRightClick;
visibility.value = draft.data.visibility;
searchableBy.value = draft.data.searchbility;
searchableBy.value = draft.data.searchableBy;
files.value = (draft.data.files || []).filter(draftFile => draftFile);
if (draft.data.poll) {
poll.value = draft.data.poll;
Expand All @@ -1191,6 +1193,7 @@ onMounted(() => {
useCw.value = init.cw != null;
cw.value = init.cw ?? null;
visibility.value = init.visibility;
searchableBy.value = init.searchableBy;
files.value = init.files ?? [];
if (init.isSchedule) {
schedule.value = {
Expand Down
9 changes: 6 additions & 3 deletions packages/frontend/src/components/MkPostFormSimple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const showAddMfmFunction = ref(defaultStore.state.enableQuickAddMfmFunction);
watch(showAddMfmFunction, () => defaultStore.set('enableQuickAddMfmFunction', showAddMfmFunction.value));
const cw = ref<string | null>(props.initialCw ?? null);
const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility));
const searchableBy = ref(defaultStore.state.rememberNoteSearchableBy ? defaultStore.state.searchableBy : defaultStore.state.defaultNotesearchableBy);
const searchableBy = ref(defaultStore.state.rememberNoteSearchbility ? defaultStore.state.searchbility : defaultStore.state.defaultNoteSearchbility);
const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]);
if (props.initialVisibleUsers) {
props.initialVisibleUsers.forEach(u => pushVisibleUser(u));
Expand Down Expand Up @@ -396,6 +396,7 @@ function watchForDraft() {
watch(event, () => saveDraft());
watch(files, () => saveDraft(), { deep: true });
watch(visibility, () => saveDraft());
watch(searchableBy, () => saveDraft());
watch(quoteId, () => saveDraft());
watch(reactionAcceptance, () => saveDraft());
watch(scheduledNoteDelete, () => saveDraft());
Expand Down Expand Up @@ -722,6 +723,7 @@ function saveDraft() {
cw: cw.value,
disableRightClick: disableRightClick.value,
visibility: visibility.value,
searchableBy: searchableBy.value,
files: files.value,
poll: poll.value,
event: event.value,
Expand Down Expand Up @@ -841,6 +843,7 @@ async function post(ev?: MouseEvent) {
event: event.value,
cw: useCw.value ? cw.value ?? '' : null,
visibility: visibility.value,
searchableBy: searchableBy.value,
visibleUserIds: visibility.value === 'specified' ? visibleUsers.value.map(u => u.id) : undefined,
reactionAcceptance: reactionAcceptance.value,
disableRightClick: disableRightClick.value,
Expand Down Expand Up @@ -1183,7 +1186,7 @@ onMounted(() => {
cw.value = draft.data.cw;
disableRightClick.value = draft.data.disableRightClick;
visibility.value = draft.data.visibility;
searchableBy.value = draft.data.searchbility;
searchableBy.value = draft.data.searchableBy;
files.value = (draft.data.files || []).filter(draftFile => draftFile);
if (draft.data.poll) {
poll.value = draft.data.poll;
Expand All @@ -1208,7 +1211,7 @@ onMounted(() => {
useCw.value = init.cw != null;
cw.value = init.cw ?? null;
visibility.value = init.visibility;
searchableBy.value = init.searchbility;
searchableBy.value = init.searchableBy;
files.value = init.files ?? [];
if (init.poll) {
poll.value = {
Expand Down

0 comments on commit f918b11

Please sign in to comment.