From e9251debe067077c91b7505d310f53388ed4944d Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 7 Jul 2019 05:12:31 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88=E9=80=81?= =?UTF-8?q?=E4=BF=A1=E6=99=82=E3=81=AB=E6=8C=87=E5=AE=9A=E3=81=AE=E5=A4=89?= =?UTF-8?q?=E6=95=B0=E3=81=AE=E5=80=A4=E3=82=92=E6=B7=BB=E4=BB=98=E5=87=BA?= =?UTF-8?q?=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 })