From 10928182034f1db668de422cda6461bd31aaaa73 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Wed, 22 May 2019 05:06:52 +0900 Subject: [PATCH 01/36] Add group update / transfer API --- locales/ja-JP.yml | 3 + .../common/views/pages/user-group-editor.vue | 81 +++++++++++++++-- src/client/app/init.ts | 2 + src/client/themes/dark.json5 | 3 + src/client/themes/light.json5 | 3 + src/models/repositories/user-group.ts | 6 ++ .../api/endpoints/users/groups/transfer.ts | 86 +++++++++++++++++++ .../api/endpoints/users/groups/update.ts | 62 +++++++++++++ 8 files changed, 240 insertions(+), 6 deletions(-) create mode 100644 src/server/api/endpoints/users/groups/transfer.ts create mode 100644 src/server/api/endpoints/users/groups/update.ts diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 904737884..c3eb0bb52 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -762,6 +762,9 @@ common/views/components/user-group-editor.vue: users: "メンバー" rename: "グループ名を変更" delete: "グループを削除" + transfer: "グループを譲渡" + transfer-are-you-sure: "グループ「$1」を「@$2」さんに譲渡しますか?" + transferred: "グループを譲渡しました" remove-user: "このグループから削除" delete-are-you-sure: "グループ「$1」を削除しますか?" deleted: "削除しました" diff --git a/src/client/app/common/views/pages/user-group-editor.vue b/src/client/app/common/views/pages/user-group-editor.vue index ef79689ae..a32148cd7 100644 --- a/src/client/app/common/views/pages/user-group-editor.vue +++ b/src/client/app/common/views/pages/user-group-editor.vue @@ -7,6 +7,7 @@ {{ $t('rename') }} {{ $t('delete') }} + {{ $t('transfer') }} @@ -28,9 +29,10 @@
+ owner @{{ user | acct }}
-
+
{{ $t('remove-user') }}
@@ -44,7 +46,7 @@ From 50251955cdeb5fbb8ff279bbcbea68d2bf606c7f Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 24 May 2019 03:57:03 +0900 Subject: [PATCH 18/36] Improve usability --- src/client/app/common/views/components/dialog.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/app/common/views/components/dialog.vue b/src/client/app/common/views/components/dialog.vue index 9f38031d6..a577da5a2 100644 --- a/src/client/app/common/views/components/dialog.vue +++ b/src/client/app/common/views/components/dialog.vue @@ -98,7 +98,7 @@ export default Vue.extend({ return { inputValue: this.input && this.input.default ? this.input.default : null, userInputValue: null, - selectedValue: null, + selectedValue: this.select ? this.select.items ? this.select.items[0].value : this.select.groupedItems[0].items[0].value : null, faTimesCircle, faQuestionCircle }; }, From bcdab799d0dc4d9b0ad7ae8e2fb438fe84ae180c Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 24 May 2019 04:17:14 +0900 Subject: [PATCH 19/36] :art: --- .../app/mobile/views/components/notification.vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/client/app/mobile/views/components/notification.vue b/src/client/app/mobile/views/components/notification.vue index 62df76cba..9dae95c9b 100644 --- a/src/client/app/mobile/views/components/notification.vue +++ b/src/client/app/mobile/views/components/notification.vue @@ -5,7 +5,7 @@
- +
@@ -21,7 +21,7 @@
- +
@@ -37,7 +37,7 @@
- +
@@ -48,7 +48,7 @@
- +
@@ -59,7 +59,7 @@
- +
@@ -130,6 +130,12 @@ export default Vue.extend({ [data-icon], .mk-reaction-icon margin-right 4px + > .name + text-overflow ellipsis + white-space nowrap + min-width 0 + overflow hidden + > .mk-time margin-left auto color var(--noteHeaderInfo) From e6f78a73ababd98642c12887881db61c714b4171 Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 24 May 2019 04:25:57 +0900 Subject: [PATCH 20/36] i18n: reaction-picker.vue (#4971) --- locales/ja-JP.yml | 1 + src/client/app/common/views/components/reaction-picker.vue | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 48c4c3682..9153655f3 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -591,6 +591,7 @@ common/views/components/poll-editor.vue: common/views/components/reaction-picker.vue: choose-reaction: "リアクションを選択" + input-reaction-placeholder: "または絵文字を入力" common/views/components/emoji-picker.vue: custom-emoji: "カスタム絵文字" diff --git a/src/client/app/common/views/components/reaction-picker.vue b/src/client/app/common/views/components/reaction-picker.vue index 461e7c909..970d43006 100644 --- a/src/client/app/common/views/components/reaction-picker.vue +++ b/src/client/app/common/views/components/reaction-picker.vue @@ -16,7 +16,7 @@
- +
From 03136caac4b4f93e60d00c9e16ecbf13e405c367 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 24 May 2019 04:57:04 +0900 Subject: [PATCH 21/36] Update instance.vue --- src/client/app/admin/views/instance.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue index c4d445fbb..588b24f6b 100644 --- a/src/client/app/admin/views/instance.vue +++ b/src/client/app/admin/views/instance.vue @@ -9,11 +9,11 @@ {{ $t('icon-url') }} {{ $t('logo-url') }} {{ $t('banner-url') }} - {{ $t('error-image-url') }} {{ $t('tos-url') }} - {{ $t('languages') }}
{{ $t('advanced-config') }} + {{ $t('error-image-url') }} + {{ $t('languages') }} {{ $t('repository-url') }} {{ $t('feedback-url') }}
From 5a4f6b4ada3df031b1b17d7c2aaf146b515f5695 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 24 May 2019 18:11:12 +0900 Subject: [PATCH 22/36] Update page-editor.vue --- .../app/common/views/components/page-editor/page-editor.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/app/common/views/components/page-editor/page-editor.vue b/src/client/app/common/views/components/page-editor/page-editor.vue index a3f69ea5c..6f4cf9b6b 100644 --- a/src/client/app/common/views/components/page-editor/page-editor.vue +++ b/src/client/app/common/views/components/page-editor/page-editor.vue @@ -11,7 +11,7 @@
- {{ $t('view-page') }} + {{ $t('view-page') }} {{ $t('title') }} From 358bb0fc0641e43d3a7452614f5ef43c19c4d2e6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 24 May 2019 18:11:33 +0900 Subject: [PATCH 23/36] =?UTF-8?q?Misskey=20Pages=20=E3=81=A7URL=E3=83=97?= =?UTF-8?q?=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=99=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 --- .../app/common/views/pages/page/page.text.vue | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/client/app/common/views/pages/page/page.text.vue b/src/client/app/common/views/pages/page/page.text.vue index ca2565c8d..326fd3905 100644 --- a/src/client/app/common/views/pages/page/page.text.vue +++ b/src/client/app/common/views/pages/page/page.text.vue @@ -1,11 +1,15 @@ - - diff --git a/src/client/app/desktop/views/pages/page.vue b/src/client/app/desktop/views/pages/page.vue deleted file mode 100644 index 1ddff08c7..000000000 --- a/src/client/app/desktop/views/pages/page.vue +++ /dev/null @@ -1,36 +0,0 @@ - - - - - diff --git a/src/client/app/mobile/script.ts b/src/client/app/mobile/script.ts index 106e843ca..d04662cc1 100644 --- a/src/client/app/mobile/script.ts +++ b/src/client/app/mobile/script.ts @@ -149,8 +149,8 @@ init((launch, os) => { { path: '/i/drive', name: 'drive', component: MkDrive }, { path: '/i/drive/folder/:folder', component: MkDrive }, { path: '/i/drive/file/:file', component: MkDrive }, - { path: '/i/pages/new', component: () => import('./views/pages/page-editor.vue').then(m => m.default) }, - { path: '/i/pages/edit/:pageId', props: true, component: () => import('./views/pages/page-editor.vue').then(m => m.default) }, + { path: '/i/pages/new', component: UI, props: route => ({ component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default) }) }, + { path: '/i/pages/edit/:pageId', component: UI, props: route => ({ component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default), initPageId: route.params.pageId }) }, { path: '/selectdrive', component: MkSelectDrive }, { path: '/search', component: MkSearch }, { path: '/tags/:tag', component: MkTag }, @@ -163,8 +163,8 @@ init((launch, os) => { { path: 'following', component: () => import('../common/views/pages/following.vue').then(m => m.default) }, { path: 'followers', component: () => import('../common/views/pages/followers.vue').then(m => m.default) }, ]}, - { path: '/@:user/pages/:page', props: true, component: () => import('./views/pages/page.vue').then(m => m.default) }, - { path: '/@:user/pages/:pageName/view-source', props: true, component: () => import('./views/pages/page-editor.vue').then(m => m.default) }, + { path: '/@:user/pages/:page', component: UI, props: route => ({ component: () => import('../common/views/pages/page/page.vue').then(m => m.default), pageName: route.params.page, username: route.params.user }) }, + { path: '/@:user/pages/:pageName/view-source', component: UI, props: route => ({ component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default), initUser: route.params.user, initPageName: route.params.pageName }) }, { path: '/notes/:note', component: MkNote }, { path: '/authorize-follow', component: MkFollow }, { path: '*', component: MkNotFound } diff --git a/src/client/app/mobile/views/pages/page-editor.vue b/src/client/app/mobile/views/pages/page-editor.vue deleted file mode 100644 index 0b04f2580..000000000 --- a/src/client/app/mobile/views/pages/page-editor.vue +++ /dev/null @@ -1,67 +0,0 @@ - - - - - diff --git a/src/client/app/mobile/views/pages/page.vue b/src/client/app/mobile/views/pages/page.vue deleted file mode 100644 index f494abffd..000000000 --- a/src/client/app/mobile/views/pages/page.vue +++ /dev/null @@ -1,39 +0,0 @@ - - - - - From c6531e8609cb68b5b9eb43ceed9af2983267f773 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Fri, 24 May 2019 19:31:40 +0900 Subject: [PATCH 25/36] Improve localization description (#4976) * Improve localization description * Update CONTRIBUTING.md * Update CONTRIBUTING.md --- CONTRIBUTING.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b01e5e6dd..d93fc50ec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,11 @@ Before creating a new issue, please search existing issues to avoid duplication. If you find the existing issue, please add your reaction or comment to the issue. ## Localization (l10n) -Please use [Crowdin](https://crowdin.com/project/misskey) for localization. +Misskey uses [Crowdin](https://crowdin.com/project/misskey) for localization management. +You can improve our translations with your Crowdin account. +Changes you make in Crowdin will be merged into develop branch. + +If you can't find the language you want to contribute with, please open an issue. ![Crowdin](https://d322cqt584bo4o.cloudfront.net/misskey/localized.svg) From 312ba501a324f97211b3c273979ae11ebc03c3f7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 24 May 2019 19:33:58 +0900 Subject: [PATCH 26/36] Add deck fallback --- src/client/app/desktop/script.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/app/desktop/script.ts b/src/client/app/desktop/script.ts index 1ec7f1cfb..ce0b96e0a 100644 --- a/src/client/app/desktop/script.ts +++ b/src/client/app/desktop/script.ts @@ -173,6 +173,10 @@ init(async (launch, os) => { { path: '/@:user/pages/:page', component: () => import('../common/views/pages/page/page.vue').then(m => m.default), props: route => ({ pageName: route.params.page, username: route.params.user }) }, { path: '/@:user/pages/:pageName/view-source', component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default), props: route => ({ initUser: route.params.user, initPageName: route.params.pageName }) }, ]}, + { path: '/i/pages/new', component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default) }, + { path: '/i/pages/edit/:pageId', component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default), props: route => ({ initPageId: route.params.pageId }) }, + { path: '/@:user/pages/:page', component: () => import('../common/views/pages/page/page.vue').then(m => m.default), props: route => ({ pageName: route.params.page, username: route.params.user }) }, + { path: '/@:user/pages/:pageName/view-source', component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default), props: route => ({ initUser: route.params.user, initPageName: route.params.pageName }) }, { path: '/i/messaging/group/:group', component: MkMessagingRoom }, { path: '/i/messaging/:user', component: MkMessagingRoom }, { path: '/i/drive', component: MkDrive }, From 3ea7a49c1c832bba12ba0591e0cc6cffbd2fc4db Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 24 May 2019 19:36:35 +0900 Subject: [PATCH 27/36] Show page title --- src/client/app/common/views/pages/page/page.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/app/common/views/pages/page/page.vue b/src/client/app/common/views/pages/page/page.vue index 649bc1e17..329046302 100644 --- a/src/client/app/common/views/pages/page/page.vue +++ b/src/client/app/common/views/pages/page/page.vue @@ -25,7 +25,7 @@ import Vue from 'vue'; import i18n from '../../../../i18n'; import { faHeart as faHeartS } from '@fortawesome/free-solid-svg-icons'; -import { faHeart } from '@fortawesome/free-regular-svg-icons'; +import { faHeart, faStickyNote } from '@fortawesome/free-regular-svg-icons'; import XBlock from './page.block.vue'; import { ASEvaluator } from '../../../../../../misc/aiscript/evaluator'; import { collectPageVars } from '../../../scripts/collect-page-vars'; @@ -91,6 +91,10 @@ export default Vue.extend({ username: this.username, }).then(page => { this.page = page; + this.$emit('init', { + title: this.page.title, + icon: faStickyNote + }); const pageVars = this.getPageVars(); this.script = new Script(new ASEvaluator(this.page.variables, pageVars, { randomSeed: Math.random(), From 7e7f94d685b0158e1f5fb800dcbc9b863b6bd6bd Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Sat, 25 May 2019 08:35:16 +0900 Subject: [PATCH 28/36] Enable query result cache for meta / stats / hashtags trend (#4978) --- src/db/postgre.ts | 12 ++++++++++++ src/server/api/endpoints/hashtags/trend.ts | 3 +++ src/server/api/endpoints/meta.ts | 2 +- src/server/api/endpoints/stats.ts | 8 ++++---- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/db/postgre.ts b/src/db/postgre.ts index 04893efe2..8e2d585e9 100644 --- a/src/db/postgre.ts +++ b/src/db/postgre.ts @@ -96,6 +96,18 @@ export function initDb(justBorrow = false, sync = false, log = false) { extra: config.db.extra, synchronize: process.env.NODE_ENV === 'test' || sync, dropSchema: process.env.NODE_ENV === 'test' && !justBorrow, + cache: { + type: 'redis', + options: { + host: config.redis.host, + port: config.redis.port, + options:{ + auth_pass: config.redis.pass, + prefix: config.redis.prefix, + db: config.redis.db || 0 + } + } + }, logging: log, logger: log ? new MyCustomLogger() : undefined, entities: [ diff --git a/src/server/api/endpoints/hashtags/trend.ts b/src/server/api/endpoints/hashtags/trend.ts index 05d571851..53a351471 100644 --- a/src/server/api/endpoints/hashtags/trend.ts +++ b/src/server/api/endpoints/hashtags/trend.ts @@ -59,6 +59,7 @@ export default define(meta, async () => { .where(`note.createdAt > :date`, { date: new Date(Date.now() - rangeA) }) .andWhere(`note.tags != '{}'`) .select(['note.tags', 'note.userId']) + .cache(60000) // 1 min .getMany(); if (tagNotes.length === 0) { @@ -108,6 +109,7 @@ export default define(meta, async () => { .where(':tag = ANY(note.tags)', { tag: tag }) .andWhere('note.createdAt < :lt', { lt: new Date(Date.now() - (interval * i)) }) .andWhere('note.createdAt > :gt', { gt: new Date(Date.now() - (interval * (i + 1))) }) + .cache(60000) // 1 min .getRawOne() .then(x => parseInt(x.count, 10)) ))); @@ -119,6 +121,7 @@ export default define(meta, async () => { .select('count(distinct note.userId)') .where(':tag = ANY(note.tags)', { tag: tag }) .andWhere('note.createdAt > :gt', { gt: new Date(Date.now() - (interval * range)) }) + .cache(60000) // 1 min .getRawOne() .then(x => parseInt(x.count, 10)) )); diff --git a/src/server/api/endpoints/meta.ts b/src/server/api/endpoints/meta.ts index 4f418c63c..d18543f56 100644 --- a/src/server/api/endpoints/meta.ts +++ b/src/server/api/endpoints/meta.ts @@ -94,7 +94,7 @@ export const meta = { export default define(meta, async (ps, me) => { const instance = await fetchMeta(true); - const emojis = await Emojis.find({ host: null }); + const emojis = await Emojis.find({ where: { host: null }, cache: 3600000 }); // 1 hour const response: any = { maintainerName: instance.maintainerName, diff --git a/src/server/api/endpoints/stats.ts b/src/server/api/endpoints/stats.ts index f85109b4b..4dca62445 100644 --- a/src/server/api/endpoints/stats.ts +++ b/src/server/api/endpoints/stats.ts @@ -57,10 +57,10 @@ export default define(meta, async () => { driveUsageLocal, driveUsageRemote ] = await Promise.all([ - Notes.count(), - Notes.count({ userHost: null }), - Users.count(), - Users.count({ host: null }), + Notes.count({ cache: 3600000 }), // 1 hour + Notes.count({ where: { userHost: null }, cache: 3600000 }), + Users.count({ cache: 3600000 }), + Users.count({ where: { host: null }, cache: 3600000 }), federationChart.getChart('hour', 1).then(chart => chart.instance.total[0]), driveChart.getChart('hour', 1).then(chart => chart.local.totalSize[0]), driveChart.getChart('hour', 1).then(chart => chart.remote.totalSize[0]), From fc7268fd129b41a86d39f08c1552578d3ee2a6dc Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 25 May 2019 08:49:58 +0900 Subject: [PATCH 29/36] :art: --- src/client/app/common/views/pages/page/page.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/client/app/common/views/pages/page/page.vue b/src/client/app/common/views/pages/page/page.vue index 329046302..7938d706b 100644 --- a/src/client/app/common/views/pages/page/page.vue +++ b/src/client/app/common/views/pages/page/page.vue @@ -162,6 +162,10 @@ export default Vue.extend({ padding 16px 32px font-size 20px + @media (max-width 400px) + padding 10px 20px + font-size 16px + > div color var(--text) padding 24px 32px @@ -171,6 +175,10 @@ export default Vue.extend({ padding 24px 32px font-size 16px + @media (max-width 400px) + padding 20px 20px + font-size 15px + > footer color var(--text) padding 0 32px 28px 32px @@ -178,12 +186,16 @@ export default Vue.extend({ @media (max-width 600px) padding 0 32px 28px 32px + @media (max-width 400px) + padding 0 20px 20px 20px + font-size 14px + > small display block opacity 0.5 > a - font-size 14px + font-size 90% > a + a margin-left 8px From 0af3e15e8268b6a5a368aeaff31a442d1c34e3e1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 25 May 2019 09:04:16 +0900 Subject: [PATCH 30/36] :art: --- src/client/app/common/views/components/url.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/app/common/views/components/url.vue b/src/client/app/common/views/components/url.vue index 840535514..1c437d92b 100644 --- a/src/client/app/common/views/components/url.vue +++ b/src/client/app/common/views/components/url.vue @@ -1,8 +1,10 @@ - {{ pathname }} + {{ self ? pathname.substr(1) : pathname }} {{ query }} {{ hash }} From 114803a86a862504fbe0d48f08724db05165c174 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 25 May 2019 09:07:50 +0900 Subject: [PATCH 32/36] Fix #4972 --- src/client/app/common/views/components/messaging.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/app/common/views/components/messaging.vue b/src/client/app/common/views/components/messaging.vue index cdd35ee8a..b21104bf9 100644 --- a/src/client/app/common/views/components/messaging.vue +++ b/src/client/app/common/views/components/messaging.vue @@ -46,7 +46,7 @@
-

{{ $t('no-history') }}

+

{{ $t('no-history') }}

{{ $t('@.loading') }}

{{ $t('start-with-user') }} From 69a916d5069204ebb6e479a099744ce49aed10a2 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Sat, 25 May 2019 09:10:51 +0900 Subject: [PATCH 33/36] =?UTF-8?q?Fix:=20Firefox=E3=81=A7=E3=83=88=E3=83=BC?= =?UTF-8?q?=E3=82=AF=E3=81=AE=E4=B8=8B=E3=81=8C=E9=9A=A0=E3=82=8C=E3=81=A6?= =?UTF-8?q?=E3=81=97=E3=81=BE=E3=81=86=20(#4974)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/common/views/components/messaging-room.vue | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/client/app/common/views/components/messaging-room.vue b/src/client/app/common/views/components/messaging-room.vue index 658dc93f6..d5fa4143a 100644 --- a/src/client/app/common/views/components/messaging-room.vue +++ b/src/client/app/common/views/components/messaging-room.vue @@ -300,17 +300,13 @@ export default Vue.extend({