From e9251debe067077c91b7505d310f53388ed4944d Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 7 Jul 2019 05:12:31 +0900 Subject: [PATCH 01/11] =?UTF-8?q?=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88?= =?UTF-8?q?=E9=80=81=E4=BF=A1=E6=99=82=E3=81=AB=E6=8C=87=E5=AE=9A=E3=81=AE?= =?UTF-8?q?=E5=A4=89=E6=95=B0=E3=81=AE=E5=80=A4=E3=82=92=E6=B7=BB=E4=BB=98?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 2 ++ .../page-editor/els/page-editor.el.button.vue | 17 ++++++++++++++++- .../app/common/views/pages/page/page.button.vue | 5 ++++- src/server/api/endpoints/page-push.ts | 5 +++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 6666e630a..e63d50165 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2035,6 +2035,8 @@ pages: _pushEvent: event: "イベント名" message: "押したときに表示するメッセージ" + variable: "送信する変数" + no-variable: "なし" script: categories: diff --git a/src/client/app/common/views/pages/page-editor/els/page-editor.el.button.vue b/src/client/app/common/views/pages/page-editor/els/page-editor.el.button.vue index 04001d856..6a82b0eec 100644 --- a/src/client/app/common/views/pages/page-editor/els/page-editor.el.button.vue +++ b/src/client/app/common/views/pages/page-editor/els/page-editor.el.button.vue @@ -17,6 +17,17 @@ @@ -39,6 +50,9 @@ export default Vue.extend({ value: { required: true }, + aiScript: { + required: true, + }, }, data() { @@ -53,7 +67,8 @@ export default Vue.extend({ if (this.value.content == null) Vue.set(this.value, 'content', null); if (this.value.event == null) Vue.set(this.value, 'event', null); if (this.value.message == null) Vue.set(this.value, 'message', null); - if (this.value.message == null) Vue.set(this.value, 'primary', false); + if (this.value.primary == null) Vue.set(this.value, 'primary', false); + if (this.value.var == null) Vue.set(this.value, 'var', null); }, }); diff --git a/src/client/app/common/views/pages/page/page.button.vue b/src/client/app/common/views/pages/page/page.button.vue index d3f030762..4dc657001 100644 --- a/src/client/app/common/views/pages/page/page.button.vue +++ b/src/client/app/common/views/pages/page/page.button.vue @@ -30,7 +30,10 @@ export default Vue.extend({ } else if (this.value.action === 'pushEvent') { this.$root.api('page-push', { pageId: this.script.page.id, - event: this.value.event + event: this.value.event, + ...(this.value.var ? { + var: this.script.vars[this.value.var] + } : {}) }); this.$root.dialog({ diff --git a/src/server/api/endpoints/page-push.ts b/src/server/api/endpoints/page-push.ts index 300df7c25..f5e1a4d1e 100644 --- a/src/server/api/endpoints/page-push.ts +++ b/src/server/api/endpoints/page-push.ts @@ -16,6 +16,10 @@ export const meta = { event: { validator: $.str + }, + + var: { + validator: $.optional.nullable.any } }, @@ -37,6 +41,7 @@ export default define(meta, async (ps, user) => { publishMainStream(user.id, 'pageEvent', { pageId: ps.pageId, event: ps.event, + var: ps.var, user: await Users.pack(user, page.userId, { detail: true }) From 4b747d20b7b595ea3a86ecce55797eea762b3422 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 7 Jul 2019 05:26:04 +0900 Subject: [PATCH 02/11] Use npx to avoid global install of ts-node --- CONTRIBUTING.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 894122b04..ea427b2c0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -220,8 +220,7 @@ const user = await Users.findOne(userId).then(ensure); ### Migration作成方法 ``` -npm i -g ts-node -ts-node ./node_modules/typeorm/cli.js migration:generate -n 変更の名前 +npx ts-node ./node_modules/typeorm/cli.js migration:generate -n 変更の名前 ``` 作成されたスクリプトは不必要な変更を含むため除去してください。 From bd8d7c3d0f1bb831f26a75a6107e34a85a1bc804 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 7 Jul 2019 06:56:13 +0900 Subject: [PATCH 03/11] Improve Page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ページをピン留めできるように * デッキでカラム内でページを見れるように --- locales/ja-JP.yml | 4 + migration/1562444565093-PinnedPage.ts | 17 ++++ .../1562448332510-PageTitleHideOption.ts | 13 +++ .../{pages => components}/page/page.block.vue | 0 .../page/page.button.vue | 2 +- .../page/page.counter.vue | 0 .../{pages => components}/page/page.if.vue | 0 .../{pages => components}/page/page.image.vue | 0 .../page/page.number-input.vue | 0 .../{pages => components}/page/page.post.vue | 0 .../page/page.section.vue | 0 .../page/page.switch.vue | 0 .../page/page.text-input.vue | 0 .../{pages => components}/page/page.text.vue | 0 .../page/page.textarea-input.vue | 0 .../page/page.textarea.vue | 0 .../views/{pages => components}/page/page.vue | 88 +++++++++---------- .../common/views/deck/deck.page-column.vue | 69 +++++++++++++++ .../views/deck/deck.user-column.home.vue | 7 ++ .../views/pages/page-editor/page-editor.vue | 6 ++ src/client/app/common/views/pages/page.vue | 63 +++++++++++++ src/client/app/desktop/script.ts | 4 +- .../app/desktop/views/home/user/user.home.vue | 5 +- src/client/app/mobile/script.ts | 3 +- .../app/mobile/views/pages/user/home.vue | 8 ++ src/models/entities/page.ts | 5 ++ src/models/entities/user-profile.ts | 13 +++ src/models/repositories/page.ts | 1 + src/models/repositories/user.ts | 4 +- src/server/api/endpoints/i/update.ts | 27 +++++- src/server/api/endpoints/pages/create.ts | 6 ++ src/server/api/endpoints/pages/update.ts | 5 ++ 32 files changed, 295 insertions(+), 55 deletions(-) create mode 100644 migration/1562444565093-PinnedPage.ts create mode 100644 migration/1562448332510-PageTitleHideOption.ts rename src/client/app/common/views/{pages => components}/page/page.block.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.button.vue (98%) rename src/client/app/common/views/{pages => components}/page/page.counter.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.if.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.image.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.number-input.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.post.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.section.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.switch.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.text-input.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.text.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.textarea-input.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.textarea.vue (100%) rename src/client/app/common/views/{pages => components}/page/page.vue (72%) create mode 100644 src/client/app/common/views/deck/deck.page-column.vue create mode 100644 src/client/app/common/views/pages/page.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index d29b96af1..32a7fad39 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1907,6 +1907,7 @@ deck/deck.user-column.vue: activity: "アクティビティ" timeline: "タイムライン" pinned-notes: "ピン留めされた投稿" + pinned-page: "ピン留めされたページ" docs: edit-this-page-on-github: "間違いや改善点を見つけましたか?" @@ -1946,6 +1947,8 @@ pages: are-you-sure-delete: "このページを削除しますか?" page-deleted: "ページを削除しました" edit-this-page: "このページを編集" + pin-this-page: "ピン留め" + unpin-this-page: "ピン留め解除" view-source: "ソースを表示" view-page: "ページを見る" like: "いいね" @@ -1964,6 +1967,7 @@ pages: url: "ページURL" summary: "ページの要約" align-center: "中央寄せ" + hide-title-when-pinned: "ピン留めされているときにタイトルを非表示" font: "フォント" fontSerif: "セリフ" fontSansSerif: "サンセリフ" diff --git a/migration/1562444565093-PinnedPage.ts b/migration/1562444565093-PinnedPage.ts new file mode 100644 index 000000000..4bdee2274 --- /dev/null +++ b/migration/1562444565093-PinnedPage.ts @@ -0,0 +1,17 @@ +import {MigrationInterface, QueryRunner} from "typeorm"; + +export class PinnedPage1562444565093 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "user_profile" ADD "pinnedPageId" character varying(32)`); + await queryRunner.query(`ALTER TABLE "user_profile" ADD CONSTRAINT "UQ_6dc44f1ceb65b1e72bacef2ca27" UNIQUE ("pinnedPageId")`); + await queryRunner.query(`ALTER TABLE "user_profile" ADD CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27" FOREIGN KEY ("pinnedPageId") REFERENCES "page"("id") ON DELETE SET NULL ON UPDATE NO ACTION`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "user_profile" DROP CONSTRAINT "FK_6dc44f1ceb65b1e72bacef2ca27"`); + await queryRunner.query(`ALTER TABLE "user_profile" DROP CONSTRAINT "UQ_6dc44f1ceb65b1e72bacef2ca27"`); + await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "pinnedPageId"`); + } + +} diff --git a/migration/1562448332510-PageTitleHideOption.ts b/migration/1562448332510-PageTitleHideOption.ts new file mode 100644 index 000000000..acc9b7e26 --- /dev/null +++ b/migration/1562448332510-PageTitleHideOption.ts @@ -0,0 +1,13 @@ +import {MigrationInterface, QueryRunner} from "typeorm"; + +export class PageTitleHideOption1562448332510 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "page" ADD "hideTitleWhenPinned" boolean NOT NULL DEFAULT false`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "page" DROP COLUMN "hideTitleWhenPinned"`); + } + +} diff --git a/src/client/app/common/views/pages/page/page.block.vue b/src/client/app/common/views/components/page/page.block.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.block.vue rename to src/client/app/common/views/components/page/page.block.vue diff --git a/src/client/app/common/views/pages/page/page.button.vue b/src/client/app/common/views/components/page/page.button.vue similarity index 98% rename from src/client/app/common/views/pages/page/page.button.vue rename to src/client/app/common/views/components/page/page.button.vue index 4dc657001..87112aca0 100644 --- a/src/client/app/common/views/pages/page/page.button.vue +++ b/src/client/app/common/views/components/page/page.button.vue @@ -49,7 +49,7 @@ export default Vue.extend({ diff --git a/src/client/app/common/views/pages/page/page.counter.vue b/src/client/app/common/views/components/page/page.counter.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.counter.vue rename to src/client/app/common/views/components/page/page.counter.vue diff --git a/src/client/app/common/views/pages/page/page.if.vue b/src/client/app/common/views/components/page/page.if.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.if.vue rename to src/client/app/common/views/components/page/page.if.vue diff --git a/src/client/app/common/views/pages/page/page.image.vue b/src/client/app/common/views/components/page/page.image.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.image.vue rename to src/client/app/common/views/components/page/page.image.vue diff --git a/src/client/app/common/views/pages/page/page.number-input.vue b/src/client/app/common/views/components/page/page.number-input.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.number-input.vue rename to src/client/app/common/views/components/page/page.number-input.vue diff --git a/src/client/app/common/views/pages/page/page.post.vue b/src/client/app/common/views/components/page/page.post.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.post.vue rename to src/client/app/common/views/components/page/page.post.vue diff --git a/src/client/app/common/views/pages/page/page.section.vue b/src/client/app/common/views/components/page/page.section.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.section.vue rename to src/client/app/common/views/components/page/page.section.vue diff --git a/src/client/app/common/views/pages/page/page.switch.vue b/src/client/app/common/views/components/page/page.switch.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.switch.vue rename to src/client/app/common/views/components/page/page.switch.vue diff --git a/src/client/app/common/views/pages/page/page.text-input.vue b/src/client/app/common/views/components/page/page.text-input.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.text-input.vue rename to src/client/app/common/views/components/page/page.text-input.vue diff --git a/src/client/app/common/views/pages/page/page.text.vue b/src/client/app/common/views/components/page/page.text.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.text.vue rename to src/client/app/common/views/components/page/page.text.vue diff --git a/src/client/app/common/views/pages/page/page.textarea-input.vue b/src/client/app/common/views/components/page/page.textarea-input.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.textarea-input.vue rename to src/client/app/common/views/components/page/page.textarea-input.vue diff --git a/src/client/app/common/views/pages/page/page.textarea.vue b/src/client/app/common/views/components/page/page.textarea.vue similarity index 100% rename from src/client/app/common/views/pages/page/page.textarea.vue rename to src/client/app/common/views/components/page/page.textarea.vue diff --git a/src/client/app/common/views/pages/page/page.vue b/src/client/app/common/views/components/page/page.vue similarity index 72% rename from src/client/app/common/views/pages/page/page.vue rename to src/client/app/common/views/components/page/page.vue index a93d5316d..99e627fd8 100644 --- a/src/client/app/common/views/pages/page/page.vue +++ b/src/client/app/common/views/components/page/page.vue @@ -1,6 +1,6 @@