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

新規にフォローした人のwithRepliesをtrueにする機能を追加 #12048

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9f5ab14
feat: add defaultWithReplies to MiUser
anatawa12 Oct 16, 2023
846994b
feat: use defaultWithReplies when creating MiFollowing
anatawa12 Oct 16, 2023
95e3cee
feat: update defaultWithReplies from API
anatawa12 Oct 16, 2023
f2cc4fe
feat: return defaultWithReplies as a part of $i
anatawa12 Oct 16, 2023
1b571c8
feat(frontend): configure defaultWithReplies
anatawa12 Oct 16, 2023
758c46e
docs(changelog): 新規にフォローした人のをデフォルトでTL二追加できるように
anatawa12 Oct 16, 2023
8054ce9
Merge branch 'develop' into with-replies-for-newly-followed-users
anatawa12 Oct 16, 2023
7351c84
fix: typo
Sayamame-beans Oct 16, 2023
680517f
style: fix lint failure
anatawa12 Oct 16, 2023
3bccba5
chore: improve UI text
syuilo Oct 16, 2023
8e3e5ae
chore: make optional params of UserFollowingService.follow() object
anatawa12 Oct 16, 2023
c183736
chore: UserFollowingService.follow() accept withReplies
anatawa12 Oct 16, 2023
e289eec
chore: add withReplies to MiFollowRequest
anatawa12 Oct 16, 2023
6e2b432
chore: process withReplies for follow request
anatawa12 Oct 16, 2023
0a2befa
feat: accept withReplies on 'following/create' endpoint
anatawa12 Oct 16, 2023
aa39b77
feat: store defaultWithReplies in client store
anatawa12 Oct 16, 2023
03b2004
Revert "feat: return defaultWithReplies as a part of $i"
anatawa12 Oct 16, 2023
7eac656
Revert "feat: update defaultWithReplies from API"
anatawa12 Oct 16, 2023
2002af6
Revert "feat: add defaultWithReplies to MiUser"
anatawa12 Oct 16, 2023
d436f8e
feat: configuring withReplies in import-following
anatawa12 Oct 16, 2023
2862d36
feat(frontend): configure withReplies
anatawa12 Oct 16, 2023
9a94194
fix(frontend): incorrectly showRepliesToOthersInTimeline can be shown
anatawa12 Oct 16, 2023
da5a0b5
fix(backend): withReplies of following/create not working
anatawa12 Oct 16, 2023
bc554fb
fix(frontend): importFollowing error
anatawa12 Oct 16, 2023
29c848a
fix: withReplies is not working with follow import
anatawa12 Oct 16, 2023
dd5dfe2
Merge branch 'develop' into with-replies-for-newly-followed-users
anatawa12 Oct 16, 2023
9284002
fix(frontend): use v-model
anatawa12 Oct 16, 2023
491a832
Merge branch 'develop' into with-replies-for-newly-followed-users
anatawa12 Oct 16, 2023
148beb6
style: fix lint
anatawa12 Oct 16, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### General
- Feat: アンテナでローカルの投稿のみ収集できるようになりました
- Enhance: 新規にフォローした人のをデフォルトでTLに追加できるように

### Client
- Enhance: TLの返信表示オプションを記憶するように
Expand Down
1 change: 1 addition & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ export interface Locale {
"deleteAll": string;
"showFixedPostForm": string;
"showFixedPostFormInChannel": string;
"withRepliesByDefaultForNewlyFollowed": string;
"newNoteRecived": string;
"sounds": string;
"sound": string;
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ serverLogs: "サーバーログ"
deleteAll: "全て削除"
showFixedPostForm: "タイムライン上部に投稿フォームを表示する"
showFixedPostFormInChannel: "タイムライン上部に投稿フォームを表示する(チャンネル)"
withRepliesByDefaultForNewlyFollowed: "あらたにフォローした人のリプライをTLに追加するようにする"
anatawa12 marked this conversation as resolved.
Show resolved Hide resolved
newNoteRecived: "新しいノートがあります"
sounds: "サウンド"
sound: "サウンド"
Expand Down
18 changes: 18 additions & 0 deletions packages/backend/migration/1697430068149-DefaultWithReplies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/

export class DefaultWithReplies1697430068149 {
name = 'DefaultWithReplies1697430068149'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "user" ADD "defaultWithReplies" boolean NOT NULL DEFAULT false`);
await queryRunner.query(`COMMENT ON COLUMN "user"."defaultWithReplies" IS 'Default value of withReplies for newly followed users'`);
}

async down(queryRunner) {
await queryRunner.query(`COMMENT ON COLUMN "user"."defaultWithReplies" IS 'Default value of withReplies for newly followed users'`);
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "defaultWithReplies"`);
}
}
3 changes: 2 additions & 1 deletion packages/backend/src/core/UserFollowingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class UserFollowingService implements OnModuleInit {
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox']
},
follower: {
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox']
id: MiUser['id']; host: MiUser['host']; uri: MiUser['host']; inbox: MiUser['inbox']; sharedInbox: MiUser['sharedInbox'], defaultWithReplies: MiUser['defaultWithReplies'];
},
silent = false,
): Promise<void> {
Expand All @@ -199,6 +199,7 @@ export class UserFollowingService implements OnModuleInit {
id: this.idService.gen(),
followerId: follower.id,
followeeId: followee.id,
withReplies: follower.defaultWithReplies,

// 非正規化
followerHost: follower.host,
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/core/entities/UserEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ export class UserEntityService implements OnModuleInit {
mutingNotificationTypes: [], // 後方互換性のため
notificationRecieveConfig: profile!.notificationRecieveConfig,
emailNotificationTypes: profile!.emailNotificationTypes,
defaultWithReplies: user!.defaultWithReplies,
achievements: profile!.achievements,
loggedInDays: profile!.loggedInDates.length,
policies: this.roleService.getUserPolicies(user.id),
Expand Down
6 changes: 6 additions & 0 deletions packages/backend/src/models/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ export class MiUser {
})
public token: string | null;

@Column('boolean', {
default: false,
comment: 'Default value of withReplies for newly followed users',
})
public defaultWithReplies: boolean;

constructor(data: Partial<MiUser>) {
if (data == null) return;

Expand Down
3 changes: 3 additions & 0 deletions packages/backend/src/models/json-schema/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ export const packedMeDetailedOnlySchema = {
nullable: false, optional: false,
},
},
defaultWithReplies: {
type: 'boolean',
},
//#region secrets
email: {
type: 'string',
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/server/api/endpoints/i/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const paramDef = {
receiveAnnouncementEmail: { type: 'boolean' },
alwaysMarkNsfw: { type: 'boolean' },
autoSensitive: { type: 'boolean' },
defaultWithReplies: { type: 'boolean' },
ffVisibility: { type: 'string', enum: ['public', 'followers', 'private'] },
pinnedPageId: { type: 'string', format: 'misskey:id', nullable: true },
mutedWords: { type: 'array' },
Expand Down Expand Up @@ -264,6 +265,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
profileUpdates.alwaysMarkNsfw = ps.alwaysMarkNsfw;
}
if (typeof ps.autoSensitive === 'boolean') profileUpdates.autoSensitive = ps.autoSensitive;
if (typeof ps.defaultWithReplies === 'boolean') updates.defaultWithReplies = ps.defaultWithReplies;
if (ps.emailNotificationTypes !== undefined) profileUpdates.emailNotificationTypes = ps.emailNotificationTypes;

if (ps.avatarId) {
Expand Down
9 changes: 9 additions & 0 deletions packages/frontend/src/pages/settings/general.vue
Copy link
Member

Choose a reason for hiding this comment

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

クライアント設定の中にあるのは違うかも(他に良い場所は思いつかないけど)

Copy link
Member Author

Choose a reason for hiding this comment

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

若干違和感はありますが元々のshowPreviewを一応参考にしました

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_gaps_s">
<MkSwitch v-model="showFixedPostForm">{{ i18n.ts.showFixedPostForm }}</MkSwitch>
<MkSwitch v-model="showFixedPostFormInChannel">{{ i18n.ts.showFixedPostFormInChannel }}</MkSwitch>
<MkSwitch v-model="defaultWithReplies">{{ i18n.ts.withRepliesByDefaultForNewlyFollowed }}</MkSwitch>
<MkFolder>
<template #label>{{ i18n.ts.pinnedList }}</template>
<!-- 複数ピン止め管理できるようにしたいけどめんどいので一旦ひとつのみ -->
Expand Down Expand Up @@ -202,6 +203,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import { miLocalStorage } from '@/local-storage.js';
import { globalEvents } from '@/events';
import { claimAchievement } from '@/scripts/achievements.js';
import { $i } from "@/account.js";

const lang = ref(miLocalStorage.getItem('lang'));
const fontSize = ref(miLocalStorage.getItem('fontSize'));
Expand Down Expand Up @@ -249,6 +251,7 @@ const mediaListWithOneImageAppearance = computed(defaultStore.makeGetterSetter('
const notificationPosition = computed(defaultStore.makeGetterSetter('notificationPosition'));
const notificationStackAxis = computed(defaultStore.makeGetterSetter('notificationStackAxis'));
const keepScreenOn = computed(defaultStore.makeGetterSetter('keepScreenOn'));
const defaultWithReplies = ref($i!.defaultWithReplies); // TODO

watch(lang, () => {
miLocalStorage.setItem('lang', lang.value as string);
Expand Down Expand Up @@ -289,6 +292,12 @@ watch([
await reloadAsk();
});

watch([defaultWithReplies], async () => {
os.api('i/update', {
defaultWithReplies: defaultWithReplies.value,
});
});

const emojiIndexLangs = ['en-US'];

function downloadEmojiIndex(lang: string) {
Expand Down
6 changes: 4 additions & 2 deletions packages/misskey-js/etc/misskey-js.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,7 @@ export type Endpoints = {
injectFeaturedNote?: boolean;
receiveAnnouncementEmail?: boolean;
alwaysMarkNsfw?: boolean;
defaultWithReplies?: boolean;
mutedWords?: string[][];
notificationRecieveConfig?: any;
emailNotificationTypes?: string[];
Expand Down Expand Up @@ -2494,6 +2495,7 @@ type MeDetailed = UserDetailed & {
noCrawle: boolean;
receiveAnnouncementEmail: boolean;
usePasswordLessLogin: boolean;
defaultWithReplies: boolean;
unreadAnnouncements: Announcement[];
twoFactorBackupCodesStock: 'full' | 'partial' | 'none';
[other: string]: any;
Expand Down Expand Up @@ -2983,9 +2985,9 @@ type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+u
//
// src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
// src/api.types.ts:630:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/api.types.ts:631:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/entities.ts:107:2 - (ae-forgotten-export) The symbol "notificationTypes_2" needs to be exported by the entry point index.d.ts
// src/entities.ts:601:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
// src/entities.ts:602:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)
Expand Down
1 change: 1 addition & 0 deletions packages/misskey-js/src/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ export type Endpoints = {
injectFeaturedNote?: boolean;
receiveAnnouncementEmail?: boolean;
alwaysMarkNsfw?: boolean;
defaultWithReplies?: boolean;
mutedWords?: string[][];
notificationRecieveConfig?: any;
emailNotificationTypes?: string[];
Expand Down
1 change: 1 addition & 0 deletions packages/misskey-js/src/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export type MeDetailed = UserDetailed & {
noCrawle: boolean;
receiveAnnouncementEmail: boolean;
usePasswordLessLogin: boolean;
defaultWithReplies: boolean;
unreadAnnouncements: Announcement[];
twoFactorBackupCodesStock: 'full' | 'partial' | 'none';
[other: string]: any;
Expand Down
Loading