From 8e6da3a0d9f2f6dbd8f1009e1accdb4e4ebae169 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 10 May 2019 17:30:28 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=B9=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E9=81=8B=E5=96=B6=E8=80=85=E3=81=8C=E3=83=94=E3=83=B3?= =?UTF-8?q?=E7=95=99=E3=82=81=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=82=92?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related #4892 --- locales/ja-JP.yml | 3 +- migration/1557476068003-PinnedUsers.ts | 13 ++++++++ src/client/app/admin/views/instance.vue | 13 +++++++- src/client/app/common/views/pages/explore.vue | 4 +++ src/models/entities/meta.ts | 5 +++ src/server/api/endpoints/admin/update-meta.ts | 11 +++++++ src/server/api/endpoints/meta.ts | 1 + src/server/api/endpoints/pinned-users.ts | 33 +++++++++++++++++++ 8 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 migration/1557476068003-PinnedUsers.ts create mode 100644 src/server/api/endpoints/pinned-users.ts diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index f1cfec046a..14b8daad48 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -338,6 +338,7 @@ auth/views/index.vue: sign-in: "サインインしてください" common/views/pages/explore.vue: + pinned-users: "ピン留めされたユーザー" popular-users: "人気のユーザー" recently-updated-users: "最近投稿したユーザー" recently-registered-users: "新規ユーザー" @@ -1262,7 +1263,7 @@ admin/views/instance.vue: invite: "招待" save: "保存" saved: "保存しました" - user-recommendation-config: "おすすめユーザー" + pinned-users: "ピン留めユーザー" email-config: "メールサーバーの設定" email-config-info: "メールアドレス確認やパスワードリセットの際に使われます。" enable-email: "メール配信を有効にする" diff --git a/migration/1557476068003-PinnedUsers.ts b/migration/1557476068003-PinnedUsers.ts new file mode 100644 index 0000000000..4e7222aafc --- /dev/null +++ b/migration/1557476068003-PinnedUsers.ts @@ -0,0 +1,13 @@ +import {MigrationInterface, QueryRunner} from "typeorm"; + +export class PinnedUsers1557476068003 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "meta" ADD "pinnedUsers" character varying(256) array NOT NULL DEFAULT '{}'::varchar[]`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "pinnedUsers"`); + } + +} diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue index cca4e5f669..d81edc8fe6 100644 --- a/src/client/app/admin/views/instance.vue +++ b/src/client/app/admin/views/instance.vue @@ -82,6 +82,14 @@ + + +
+ + {{ $t('save') }} +
+
+
@@ -190,6 +198,7 @@ export default Vue.extend({ enableServiceWorker: false, swPublicKey: null, swPrivateKey: null, + pinnedUsers: [], faHeadset, faShieldAlt, faGhost, faUserPlus, farEnvelope, faBolt }; }, @@ -239,6 +248,7 @@ export default Vue.extend({ this.enableServiceWorker = meta.enableServiceWorker; this.swPublicKey = meta.swPublickey; this.swPrivateKey = meta.swPrivateKey; + this.pinnedUsers = meta.pinnedUsers.join('\n'); }); }, @@ -297,7 +307,8 @@ export default Vue.extend({ smtpPass: this.smtpAuth ? this.smtpPass : '', enableServiceWorker: this.enableServiceWorker, swPublicKey: this.swPublicKey, - swPrivateKey: this.swPrivateKey + swPrivateKey: this.swPrivateKey, + pinnedUsers: this.pinnedUsers.split('\n') }).then(() => { this.$root.dialog({ type: 'success', diff --git a/src/client/app/common/views/pages/explore.vue b/src/client/app/common/views/pages/explore.vue index 107603d69e..d0e98035f8 100644 --- a/src/client/app/common/views/pages/explore.vue +++ b/src/client/app/common/views/pages/explore.vue @@ -26,6 +26,9 @@