「両方」オプションを実装
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
|
## 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':
|
case 'notification':
|
||||||
await sendNotificationAlert(text, user);
|
await sendNotificationAlert(text, user);
|
||||||
break;
|
break;
|
||||||
|
case 'both':
|
||||||
|
await Promise.all([
|
||||||
|
sendNotificationAlert(text, user),
|
||||||
|
sendNoteAlert(text, user),
|
||||||
|
]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
export const alertModes = [
|
export const alertModes = [
|
||||||
'note',
|
'note',
|
||||||
'notification',
|
'notification',
|
||||||
|
'both',
|
||||||
'nothing'
|
'nothing'
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
|
|
|
@ -197,13 +197,6 @@ export const MisshaiPage: React.VFC = () => {
|
||||||
<AnnouncementList />
|
<AnnouncementList />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</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">
|
<div className="misshaiPageLayout">
|
||||||
<section className="card misshaiData">
|
<section className="card misshaiData">
|
||||||
<div className="body">
|
<div className="body">
|
||||||
|
@ -248,29 +241,34 @@ export const MisshaiPage: React.VFC = () => {
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</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">
|
<div className="misshaiPageLayout">
|
||||||
<section className="card alertModeSetting">
|
<section className="card alertModeSetting">
|
||||||
<div className="body">
|
<div className="body">
|
||||||
<h1 className="mb-2"><i className="bi-gear"></i> {t('alertMode')}</h1>
|
<h1 className="mb-2"><i className="bi-gear"></i> {t('alertMode')}</h1>
|
||||||
<div className="vstack">
|
<div className="vstack">
|
||||||
{
|
{ alertModes.map((mode) => (
|
||||||
alertModes.map((mode) => (
|
<label key={mode} className="input-check">
|
||||||
<label key={mode} className="input-check">
|
<input type="radio" checked={mode === draft.alertMode} onChange={() => {
|
||||||
<input type="radio" checked={mode === draft.alertMode} onChange={() => {
|
updateSetting({ alertMode: mode });
|
||||||
updateSetting({ alertMode: mode });
|
}} />
|
||||||
}} />
|
<span>{t(`_alertMode.${mode}`)}</span>
|
||||||
<span>{t(`_alertMode.${mode}`)}</span>
|
</label>
|
||||||
</label>
|
))}
|
||||||
))
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
{ draft.alertMode === 'notification' && (
|
{ (draft.alertMode === 'notification' || draft.alertMode === 'both') && (
|
||||||
<div className="alert bg-danger mt-2">
|
<div className="alert bg-danger mt-2">
|
||||||
<i className="icon bi bi-exclamation-circle"></i>
|
<i className="icon bi bi-exclamation-circle"></i>
|
||||||
{t('_alertMode.notificationWarning')}
|
{t('_alertMode.notificationWarning')}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{ draft.alertMode === 'note' && (
|
{ (draft.alertMode === 'note' || draft.alertMode === 'both') && (
|
||||||
<>
|
<>
|
||||||
<h2 className="mt-2 mb-1">{t('visibility')}</h2>
|
<h2 className="mt-2 mb-1">{t('visibility')}</h2>
|
||||||
<div className="vstack">
|
<div className="vstack">
|
||||||
|
|
|
@ -99,6 +99,7 @@
|
||||||
"_alertMode": {
|
"_alertMode": {
|
||||||
"note": "自動的にノートを投稿",
|
"note": "自動的にノートを投稿",
|
||||||
"notification": "Misskeyに通知(標準)",
|
"notification": "Misskeyに通知(標準)",
|
||||||
|
"both": "両方",
|
||||||
"nothing": "通知しない",
|
"nothing": "通知しない",
|
||||||
"notificationWarning": "「Misskey に通知」オプションは古いMisskeyでは動作しません。"
|
"notificationWarning": "「Misskey に通知」オプションは古いMisskeyでは動作しません。"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue