From 51bafe82598691075d9ca097b5450764bd0beac3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 25 Jul 2018 01:14:38 +0900 Subject: [PATCH] #1893 --- cli/mark-admin.js | 23 +++++++++++++++++++ cli/mark-verified.js | 23 +++++++++++++++++++ locales/ja.yml | 1 + .../common/views/components/note-header.vue | 5 ++++ src/models/user.ts | 3 ++- 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 cli/mark-admin.js create mode 100644 cli/mark-verified.js diff --git a/cli/mark-admin.js b/cli/mark-admin.js new file mode 100644 index 0000000000..e10035fde9 --- /dev/null +++ b/cli/mark-admin.js @@ -0,0 +1,23 @@ +const mongo = require('mongodb'); +const User = require('../built/models/user').default; + +const args = process.argv.slice(2); + +const user = args[0]; + +const q = user.startsWith('@') ? { + username: user.split('@')[1], + host: user.split('@')[2] || null +} : { _id: new mongo.ObjectID(user) }; + +console.log(`Mark as admin ${user}...`); + +User.update(q, { + $set: { + isAdmin: true + } +}).then(() => { + console.log(`Done ${user}`); +}, e => { + console.error(e); +}); diff --git a/cli/mark-verified.js b/cli/mark-verified.js new file mode 100644 index 0000000000..cdee91ddca --- /dev/null +++ b/cli/mark-verified.js @@ -0,0 +1,23 @@ +const mongo = require('mongodb'); +const User = require('../built/models/user').default; + +const args = process.argv.slice(2); + +const user = args[0]; + +const q = user.startsWith('@') ? { + username: user.split('@')[1], + host: user.split('@')[2] || null +} : { _id: new mongo.ObjectID(user) }; + +console.log(`Mark as verfied ${user}...`); + +User.update(q, { + $set: { + isVerified: true + } +}).then(() => { + console.log(`Done ${user}`); +}, e => { + console.error(e); +}); diff --git a/locales/ja.yml b/locales/ja.yml index 7f9abf73e2..522dbfaa68 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -56,6 +56,7 @@ common: my-token-regenerated: "あなたのトークンが更新されたのでサインアウトします。" i-like-sushi: "私は(プリンよりむしろ)寿司が好き" show-reversi-board-labels: "リバーシのボードの行と列のラベルを表示" + verified-user: "認証済みのユーザー" reversi: drawn: "引き分け" diff --git a/src/client/app/common/views/components/note-header.vue b/src/client/app/common/views/components/note-header.vue index 25a3339264..9bba6990db 100644 --- a/src/client/app/common/views/components/note-header.vue +++ b/src/client/app/common/views/components/note-header.vue @@ -2,6 +2,7 @@
{{ note.user | userName }} + %fa:bookmark% admin bot cat @@ -69,6 +70,10 @@ root(isDark) &:hover text-decoration underline + > .is-verified + margin-right 8px + color #4dabf7 + > .is-admin > .is-bot > .is-cat diff --git a/src/models/user.ts b/src/models/user.ts index 8ba788331d..8681b5b0c3 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -95,7 +95,8 @@ export interface ILocalUser extends IUserBase { lastUsedAt: Date; isBot: boolean; isCat: boolean; - isPro: boolean; + isAdmin?: boolean; + isVerified?: boolean; twoFactorSecret: string; twoFactorEnabled: boolean; twoFactorTempSecret?: string;