「両方」オプションを実装
This commit is contained in:
parent
fd8d7ed37b
commit
288c594f27
6 changed files with 52 additions and 19 deletions
|
@ -1,3 +1,6 @@
|
|||
## 2.4.0
|
||||
* アラート通知方法に「両方」を追加
|
||||
|
||||
## 2.3.0
|
||||
* 韓国語サポート
|
||||
* デザイン調整
|
||||
|
|
24
migration/1644940446672-alertModeBoth.ts
Normal file
24
migration/1644940446672-alertModeBoth.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import {MigrationInterface, QueryRunner} from 'typeorm';
|
||||
|
||||
export class alertModeBoth1644940446672 implements MigrationInterface {
|
||||
name = 'alertModeBoth1644940446672'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query('ALTER TYPE "public"."user_alertmode_enum" RENAME TO "user_alertmode_enum_old"');
|
||||
await queryRunner.query('CREATE TYPE "user_alertmode_enum" AS ENUM(\'note\', \'notification\', \'both\', \'nothing\')');
|
||||
await queryRunner.query('ALTER TABLE "user" ALTER COLUMN "alertMode" DROP DEFAULT');
|
||||
await queryRunner.query('ALTER TABLE "user" ALTER COLUMN "alertMode" TYPE "user_alertmode_enum" USING "alertMode"::"text"::"user_alertmode_enum"');
|
||||
await queryRunner.query('ALTER TABLE "user" ALTER COLUMN "alertMode" SET DEFAULT \'notification\'');
|
||||
await queryRunner.query('DROP TYPE "user_alertmode_enum_old"');
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query('CREATE TYPE "user_alertmode_enum_old" AS ENUM(\'note\', \'notification\', \'nothing\')');
|
||||
await queryRunner.query('ALTER TABLE "user" ALTER COLUMN "alertMode" DROP DEFAULT');
|
||||
await queryRunner.query('ALTER TABLE "user" ALTER COLUMN "alertMode" TYPE "user_alertmode_enum_old" USING "alertMode"::"text"::"user_alertmode_enum_old"');
|
||||
await queryRunner.query('ALTER TABLE "user" ALTER COLUMN "alertMode" SET DEFAULT \'notification\'');
|
||||
await queryRunner.query('DROP TYPE "user_alertmode_enum"');
|
||||
await queryRunner.query('ALTER TYPE "user_alertmode_enum_old" RENAME TO "user_alertmode_enum"');
|
||||
}
|
||||
|
||||
}
|
|
@ -16,6 +16,12 @@ export const sendAlert = async (user: User) => {
|
|||
case 'notification':
|
||||
await sendNotificationAlert(text, user);
|
||||
break;
|
||||
case 'both':
|
||||
await Promise.all([
|
||||
sendNotificationAlert(text, user),
|
||||
sendNoteAlert(text, user),
|
||||
]);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
export const alertModes = [
|
||||
'note',
|
||||
'notification',
|
||||
'both',
|
||||
'nothing'
|
||||
] as const;
|
||||
|
||||
|
|
|
@ -197,13 +197,6 @@ export const MisshaiPage: React.VFC = () => {
|
|||
<AnnouncementList />
|
||||
</div>
|
||||
</section>
|
||||
<section className="card misshaiRanking">
|
||||
<div className="body">
|
||||
<h1><i className="bi-bar-chart"></i> {t('_missHai.ranking')}</h1>
|
||||
<Ranking limit={limit} />
|
||||
{limit && <button className="btn link" onClick={() => setLimit(undefined)}>{t('_missHai.showAll')}</button>}
|
||||
</div>
|
||||
</section>
|
||||
<div className="misshaiPageLayout">
|
||||
<section className="card misshaiData">
|
||||
<div className="body">
|
||||
|
@ -248,29 +241,34 @@ export const MisshaiPage: React.VFC = () => {
|
|||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<section className="card misshaiRanking">
|
||||
<div className="body">
|
||||
<h1><i className="bi-bar-chart"></i> {t('_missHai.ranking')}</h1>
|
||||
<Ranking limit={limit} />
|
||||
{limit && <button className="btn link" onClick={() => setLimit(undefined)}>{t('_missHai.showAll')}</button>}
|
||||
</div>
|
||||
</section>
|
||||
<div className="misshaiPageLayout">
|
||||
<section className="card alertModeSetting">
|
||||
<div className="body">
|
||||
<h1 className="mb-2"><i className="bi-gear"></i> {t('alertMode')}</h1>
|
||||
<div className="vstack">
|
||||
{
|
||||
alertModes.map((mode) => (
|
||||
{ alertModes.map((mode) => (
|
||||
<label key={mode} className="input-check">
|
||||
<input type="radio" checked={mode === draft.alertMode} onChange={() => {
|
||||
updateSetting({ alertMode: mode });
|
||||
}} />
|
||||
<span>{t(`_alertMode.${mode}`)}</span>
|
||||
</label>
|
||||
))
|
||||
}
|
||||
))}
|
||||
</div>
|
||||
{ draft.alertMode === 'notification' && (
|
||||
{ (draft.alertMode === 'notification' || draft.alertMode === 'both') && (
|
||||
<div className="alert bg-danger mt-2">
|
||||
<i className="icon bi bi-exclamation-circle"></i>
|
||||
{t('_alertMode.notificationWarning')}
|
||||
</div>
|
||||
)}
|
||||
{ draft.alertMode === 'note' && (
|
||||
{ (draft.alertMode === 'note' || draft.alertMode === 'both') && (
|
||||
<>
|
||||
<h2 className="mt-2 mb-1">{t('visibility')}</h2>
|
||||
<div className="vstack">
|
||||
|
|
|
@ -99,6 +99,7 @@
|
|||
"_alertMode": {
|
||||
"note": "自動的にノートを投稿",
|
||||
"notification": "Misskeyに通知(標準)",
|
||||
"both": "両方",
|
||||
"nothing": "通知しない",
|
||||
"notificationWarning": "「Misskey に通知」オプションは古いMisskeyでは動作しません。"
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue