From a814652af0b96778cd0e5f813d5ee5795ab6c6f3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 18 Feb 2020 19:05:11 +0900 Subject: [PATCH] Implement featured note injection --- locales/ja-JP.yml | 1 + .../1582019042083-featured-injecttion.ts | 14 ++++++ src/client/components/date-separated-list.vue | 12 ++++- src/client/components/note.vue | 7 +-- src/client/components/notes.vue | 2 +- src/client/pages/my-settings/index.vue | 9 ++++ src/models/entities/user-profile.ts | 5 +++ src/models/repositories/note.ts | 3 +- src/models/repositories/user.ts | 1 + src/server/api/common/inject-featured.ts | 45 +++++++++++++++++++ src/server/api/common/inject-promo.ts | 10 ++--- src/server/api/common/signup.ts | 1 - src/server/api/define.ts | 1 + src/server/api/endpoints/i/update.ts | 5 +++ src/server/api/endpoints/notes/featured.ts | 1 + .../api/endpoints/notes/global-timeline.ts | 4 +- .../api/endpoints/notes/hybrid-timeline.ts | 4 +- .../api/endpoints/notes/local-timeline.ts | 4 +- src/server/api/endpoints/notes/timeline.ts | 4 +- 19 files changed, 117 insertions(+), 16 deletions(-) create mode 100644 migration/1582019042083-featured-injecttion.ts create mode 100644 src/server/api/common/inject-featured.ts diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index fd668c03d..1d8b09b1c 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -416,6 +416,7 @@ promotion: "プロモーション" promote: "プロモート" numberOfDays: "日数" hideThisNote: "このノートを非表示" +showFeaturedNotesInTimeline: "タイムラインにおすすめのノートを表示する" _ago: unknown: "謎" diff --git a/migration/1582019042083-featured-injecttion.ts b/migration/1582019042083-featured-injecttion.ts new file mode 100644 index 000000000..9c8498997 --- /dev/null +++ b/migration/1582019042083-featured-injecttion.ts @@ -0,0 +1,14 @@ +import {MigrationInterface, QueryRunner} from "typeorm"; + +export class featuredInjecttion1582019042083 implements MigrationInterface { + name = 'featuredInjecttion1582019042083' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "user_profile" ADD "injectFeaturedNote" boolean NOT NULL DEFAULT true`, undefined); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "injectFeaturedNote"`, undefined); + } + +} diff --git a/src/client/components/date-separated-list.vue b/src/client/components/date-separated-list.vue index c425c02dc..5c6917b3f 100644 --- a/src/client/components/date-separated-list.vue +++ b/src/client/components/date-separated-list.vue @@ -2,7 +2,7 @@