Skip to content

Commit

Permalink
enhance(profile): 相互リンク機能の改修 (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyatea authored Aug 10, 2024
1 parent b6a5a36 commit 5a9d8a5
Show file tree
Hide file tree
Showing 41 changed files with 472 additions and 901 deletions.
68 changes: 52 additions & 16 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2401,13 +2401,13 @@ export interface Locale extends ILocale {
*/
"unsetUserBannerConfirm": string;
/**
* 相互バナーを解除
* 相互リンクを解除
*/
"unsetUserMutualBanner": string;
"unsetUserMutualLink": string;
/**
* 相互バナーを解除しますか
* 相互リンクを解除しますか
*/
"unsetUserMutualBannerConfirm": string;
"unsetUserMutualLinkConfirm": string;
/**
* すべてのファイルを削除
*/
Expand Down Expand Up @@ -5092,9 +5092,9 @@ export interface Locale extends ILocale {
*/
"here": string;
/**
* 相互バナー
* 相互リンク
*/
"mutualBanner": string;
"mutualLink": string;
/**
* このユーザーのバナー
*/
Expand Down Expand Up @@ -6884,6 +6884,14 @@ export interface Locale extends ILocale {
* アイコンデコレーションの最大取付個数
*/
"avatarDecorationLimit": string;
/**
* 相互リンクのセクションの最大数
*/
"mutualLinkSectionLimit": string;
/**
* セクション内の相互リンクの最大数
*/
"mutualLinkLimit": string;
};
"_condition": {
/**
Expand Down Expand Up @@ -8233,9 +8241,9 @@ export interface Locale extends ILocale {
*/
"write:admin:unset-user-banner": string;
/**
* ユーザーの相互バナーを削除する
* ユーザーの相互リンクを削除する
*/
"write:admin:unset-user-mutual-banner": string;
"write:admin:unset-user-mutual-link": string;
/**
* ユーザーの凍結を解除する
*/
Expand Down Expand Up @@ -8823,21 +8831,49 @@ export interface Locale extends ILocale {
*/
"avatarDecorationMax": ParameterizedString<"max">;
/**
* 自身の相互リンクのバナーを設定
*/
"myMutualBanner": string;
/**
* あなた自身が相互リンクのバナーとして設定してほしい画像を設定することができます。
* 相互リンクを編集
*/
"myMutualBannerDescription": string;
"mutualLinksEdit": string;
/**
* 相互リンクのバナー
*/
"mutualBanner": string;
"mutualLinksBanner": string;
/**
* 説明
*/
"mutualBannerDescriptionEdit": string;
"mutualLinksDescriptionEdit": string;
/**
* リンク先のURL
*/
"mutualLinksUrl": string;
/**
* このセクションをプロフィールにピン留め
*/
"mutualLinkPining": string;
/**
* 相互リンクを設定すると、あなたのプロフィールにバナーが表示されます。
*/
"mutualLinksDescription": string;
/**
* 相互リンクを追加
*/
"addMutualLink": string;
/**
* セクションを追加
*/
"addMutualLinkSection": string;
/**
* セクション名
*/
"sectionName": string;
/**
* セクション名を表示しないようにする
*/
"sectionNameNoneDescription": string;
/**
* セクション名を表示しない
*/
"sectionNameNone": string;
};
"_exportOrImport": {
/**
Expand Down
25 changes: 17 additions & 8 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,8 @@ unsetUserAvatar: "アイコンを解除"
unsetUserAvatarConfirm: "アイコンを解除しますか?"
unsetUserBanner: "バナーを解除"
unsetUserBannerConfirm: "バナーを解除しますか?"
unsetUserMutualBanner: "相互バナーを解除"
unsetUserMutualBannerConfirm: "相互バナーを解除しますか"
unsetUserMutualLink: "相互リンクを削除"
unsetUserMutualLinkConfirm: "相互リンクを削除しますか"
deleteAllFiles: "すべてのファイルを削除"
deleteAllFilesConfirm: "すべてのファイルを削除しますか?"
removeAllFollowing: "フォローを全解除"
Expand Down Expand Up @@ -1268,7 +1268,7 @@ reportComplete: "通報完了"
blockThisUser: "このユーザーをブロックする"
muteThisUser: "このユーザーをミュートする"
here: "こちら"
mutualBanner: "相互バナー"
mutualLink: "相互リンク"
mutualBannerThisUser: "このユーザーのバナー"
maximum: "最大"

Expand Down Expand Up @@ -1776,6 +1776,8 @@ _role:
canUseDriveFileInSoundSettings: "サウンド設定でドライブのファイルを利用"
canUseReaction: "リアクションの利用"
avatarDecorationLimit: "アイコンデコレーションの最大取付個数"
mutualLinkSectionLimit: "相互リンクのセクションの最大数"
mutualLinkLimit: "セクション内の相互リンクの最大数"
_condition:
roleAssignedTo: "マニュアルロールにアサイン済み"
isLocal: "ローカルユーザー"
Expand Down Expand Up @@ -2157,7 +2159,7 @@ _permissions:
"write:admin:suspend-user": "ユーザーを凍結する"
"write:admin:unset-user-avatar": "ユーザーのアバターを削除する"
"write:admin:unset-user-banner": "ユーザーのバーナーを削除する"
"write:admin:unset-user-mutual-banner": "ユーザーの相互バナーを削除する"
"write:admin:unset-user-mutual-link": "ユーザーの相互リンクを削除する"
"write:admin:unsuspend-user": "ユーザーの凍結を解除する"
"write:admin:meta": "インスタンスのメタデータを操作する"
"write:admin:user-note": "モデレーションノートを操作する"
Expand Down Expand Up @@ -2319,10 +2321,17 @@ _profile:
changeBanner: "バナー画像を変更"
verifiedLinkDescription: "内容にURLを設定すると、リンク先のWebサイトに自分のプロフィールへのリンクが含まれている場合に所有者確認済みアイコンを表示させることができます。"
avatarDecorationMax: "最大{max}つまでデコレーションを付けられます。"
myMutualBanner: "自身の相互リンクのバナーを設定"
myMutualBannerDescription: "あなた自身が相互リンクのバナーとして設定してほしい画像を設定することができます。"
mutualBanner: "相互リンクのバナー"
mutualBannerDescriptionEdit: "説明"
mutualLinksEdit: "相互リンクを編集"
mutualLinksBanner: "相互リンクのバナー"
mutualLinksDescriptionEdit: "説明"
mutualLinksUrl: "リンク先のURL"
mutualLinkPining: "このセクションをプロフィールにピン留め"
mutualLinksDescription: "相互リンクを設定すると、あなたのプロフィールにバナーが表示されます。"
addMutualLink: "相互リンクを追加"
addMutualLinkSection: "セクションを追加"
sectionName: "セクション名"
sectionNameNoneDescription: "セクション名を表示しないようにする"
sectionNameNone: "セクション名を表示しない"

_exportOrImport:
allNotes: "全てのノート"
Expand Down
27 changes: 0 additions & 27 deletions packages/backend/migration/1723213482131-mutualBanner.js

This file was deleted.

11 changes: 11 additions & 0 deletions packages/backend/migration/1723311628855-mutuallinks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export class Mutuallinks1723311628855 {
name = 'Mutuallinks1723311628855'

async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "user_profile" ADD "mutualLinkSections" jsonb NOT NULL DEFAULT '[]'`);
}

async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "mutualLinkSections"`);
}
}
24 changes: 0 additions & 24 deletions packages/backend/src/core/CoreModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import { Module } from '@nestjs/common';
import { FanoutTimelineEndpointService } from '@/core/FanoutTimelineEndpointService.js';
import { UserBannerEntityService } from '@/core/entities/UserBannerEntityService.js';
import { UserBannerPiningEntityService } from '@/core/entities/UserBannerPiningEntityService.js';
import { AccountMoveService } from './AccountMoveService.js';
import { AccountUpdateService } from './AccountUpdateService.js';
import { AiService } from './AiService.js';
Expand Down Expand Up @@ -37,8 +35,6 @@ import { ModerationLogService } from './ModerationLogService.js';
import { NoteCreateService } from './NoteCreateService.js';
import { NoteDeleteService } from './NoteDeleteService.js';
import { NotePiningService } from './NotePiningService.js';
import { UserBannerPiningService } from './UserBannerPiningService.js';
import { UserBannerService } from './UserBannerService.js';
import { NoteReadService } from './NoteReadService.js';
import { NotificationService } from './NotificationService.js';
import { PollService } from './PollService.js';
Expand Down Expand Up @@ -177,8 +173,6 @@ const $ModerationLogService: Provider = { provide: 'ModerationLogService', useEx
const $NoteCreateService: Provider = { provide: 'NoteCreateService', useExisting: NoteCreateService };
const $NoteDeleteService: Provider = { provide: 'NoteDeleteService', useExisting: NoteDeleteService };
const $NotePiningService: Provider = { provide: 'NotePiningService', useExisting: NotePiningService };
const $UserBannerPiningService: Provider = { provide: 'UserBannerPiningService', useExisting: UserBannerPiningService };
const $UserBannerService: Provider = { provide: 'UserBannerService', useExisting: UserBannerService };
const $NoteReadService: Provider = { provide: 'NoteReadService', useExisting: NoteReadService };
const $NotificationService: Provider = { provide: 'NotificationService', useExisting: NotificationService };
const $PollService: Provider = { provide: 'PollService', useExisting: PollService };
Expand Down Expand Up @@ -259,8 +253,6 @@ const $PageLikeEntityService: Provider = { provide: 'PageLikeEntityService', use
const $SigninEntityService: Provider = { provide: 'SigninEntityService', useExisting: SigninEntityService };
const $UserEntityService: Provider = { provide: 'UserEntityService', useExisting: UserEntityService };
const $UserListEntityService: Provider = { provide: 'UserListEntityService', useExisting: UserListEntityService };
const $UserBannerEntityService: Provider = { provide: 'UserBannerEntityService', useExisting: UserBannerEntityService };
const $UserBannerPiningEntityService: Provider = { provide: 'UserBannerPiningEntityService', useExisting: UserBannerPiningEntityService };
const $FlashEntityService: Provider = { provide: 'FlashEntityService', useExisting: FlashEntityService };
const $FlashLikeEntityService: Provider = { provide: 'FlashLikeEntityService', useExisting: FlashLikeEntityService };
const $RoleEntityService: Provider = { provide: 'RoleEntityService', useExisting: RoleEntityService };
Expand Down Expand Up @@ -323,8 +315,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
NoteCreateService,
NoteDeleteService,
NotePiningService,
UserBannerPiningService,
UserBannerService,
NoteReadService,
NotificationService,
PollService,
Expand Down Expand Up @@ -403,8 +393,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
SigninEntityService,
UserEntityService,
UserListEntityService,
UserBannerEntityService,
UserBannerPiningEntityService,
FlashEntityService,
FlashLikeEntityService,
RoleEntityService,
Expand Down Expand Up @@ -463,8 +451,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
$NoteCreateService,
$NoteDeleteService,
$NotePiningService,
$UserBannerService,
$UserBannerPiningService,
$NoteReadService,
$NotificationService,
$PollService,
Expand Down Expand Up @@ -543,8 +529,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
$SigninEntityService,
$UserEntityService,
$UserListEntityService,
$UserBannerEntityService,
$UserBannerPiningEntityService,
$FlashEntityService,
$FlashLikeEntityService,
$RoleEntityService,
Expand Down Expand Up @@ -604,8 +588,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
NoteCreateService,
NoteDeleteService,
NotePiningService,
UserBannerService,
UserBannerPiningService,
NoteReadService,
NotificationService,
PollService,
Expand Down Expand Up @@ -683,8 +665,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
SigninEntityService,
UserEntityService,
UserListEntityService,
UserBannerEntityService,
UserBannerPiningEntityService,
FlashEntityService,
FlashLikeEntityService,
RoleEntityService,
Expand Down Expand Up @@ -743,8 +723,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
$NoteCreateService,
$NoteDeleteService,
$NotePiningService,
$UserBannerService,
$UserBannerPiningService,
$NoteReadService,
$NotificationService,
$PollService,
Expand Down Expand Up @@ -822,8 +800,6 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
$SigninEntityService,
$UserEntityService,
$UserListEntityService,
$UserBannerEntityService,
$UserBannerPiningEntityService,
$FlashEntityService,
$FlashLikeEntityService,
$RoleEntityService,
Expand Down
6 changes: 6 additions & 0 deletions packages/backend/src/core/RoleService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export type RolePolicies = {
userEachUserListsLimit: number;
rateLimitFactor: number;
avatarDecorationLimit: number;
mutualLinkSectionLimit: number;
mutualLinkLimit: number;
};

export const DEFAULT_POLICIES: RolePolicies = {
Expand Down Expand Up @@ -108,6 +110,8 @@ export const DEFAULT_POLICIES: RolePolicies = {
userEachUserListsLimit: 50,
rateLimitFactor: 1,
avatarDecorationLimit: 1,
mutualLinkSectionLimit: 1,
mutualLinkLimit: 15,
};

@Injectable()
Expand Down Expand Up @@ -420,6 +424,8 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
userEachUserListsLimit: calc('userEachUserListsLimit', vs => Math.max(...vs)),
rateLimitFactor: calc('rateLimitFactor', vs => Math.max(...vs)),
avatarDecorationLimit: calc('avatarDecorationLimit', vs => Math.max(...vs)),
mutualLinkSectionLimit: calc('mutualLinkSectionLimit', vs => Math.max(...vs)),
mutualLinkLimit: calc('mutualLinkLimit', vs => Math.max(...vs)),
};
}

Expand Down
Loading

0 comments on commit 5a9d8a5

Please sign in to comment.