1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-11-24 23:26:17 +09:00

お知らせメールを受け取るかどうかの設定を追加

This commit is contained in:
syuilo 2021-02-06 22:47:15 +09:00
parent 4ecd036d0a
commit 547da89c7d
6 changed files with 37 additions and 1 deletions

View File

@ -700,6 +700,7 @@ capacity: "容量"
inUse: "使用中"
editCode: "コードを編集"
apply: "適用"
receiveAnnouncementFromInstance: "インスタンスからのお知らせを受け取る"
_plugin:
install: "プラグインのインストール"

View File

@ -0,0 +1,14 @@
import {MigrationInterface, QueryRunner} from "typeorm";
export class announcementEmail1612619156584 implements MigrationInterface {
name = 'announcementEmail1612619156584'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "user_profile" ADD "receiveAnnouncementEmail" boolean NOT NULL DEFAULT true`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "receiveAnnouncementEmail"`);
}
}

View File

@ -8,6 +8,10 @@
{{ $i.email || $ts.notSet }}
</FormLink>
</FormGroup>
<FormSwitch :value="$i.receiveAnnouncementEmail" @update:value="onChangeReceiveAnnouncementEmail">
{{ $ts.receiveAnnouncementFromInstance }}
</FormSwitch>
</FormBase>
</template>
@ -19,6 +23,7 @@ import FormButton from '@/components/form/button.vue';
import FormLink from '@/components/form/link.vue';
import FormBase from '@/components/form/base.vue';
import FormGroup from '@/components/form/group.vue';
import FormSwitch from '@/components/form/switch.vue';
import * as os from '@/os';
export default defineComponent({
@ -26,6 +31,7 @@ export default defineComponent({
FormBase,
FormLink,
FormButton,
FormSwitch,
FormGroup,
},
@ -46,7 +52,11 @@ export default defineComponent({
},
methods: {
onChangeReceiveAnnouncementEmail(v) {
os.api('i/update', {
receiveAnnouncementEmail: v
});
},
}
});
</script>

View File

@ -133,6 +133,11 @@ export class UserProfile {
})
public injectFeaturedNote: boolean;
@Column('boolean', {
default: true,
})
public receiveAnnouncementEmail: boolean;
@Column({
...id(),
nullable: true

View File

@ -236,6 +236,7 @@ export class UserRepository extends Repository<User> {
avatarId: user.avatarId,
bannerId: user.bannerId,
injectFeaturedNote: profile!.injectFeaturedNote,
receiveAnnouncementEmail: profile!.receiveAnnouncementEmail,
alwaysMarkNsfw: profile!.alwaysMarkNsfw,
carefulBot: profile!.carefulBot,
autoAcceptFollowed: profile!.autoAcceptFollowed,

View File

@ -135,6 +135,10 @@ export const meta = {
validator: $.optional.bool,
},
receiveAnnouncementEmail: {
validator: $.optional.bool,
},
alwaysMarkNsfw: {
validator: $.optional.bool,
desc: {
@ -219,6 +223,7 @@ export default define(meta, async (ps, user, token) => {
if (typeof ps.noCrawle === 'boolean') profileUpdates.noCrawle = ps.noCrawle;
if (typeof ps.isCat === 'boolean') updates.isCat = ps.isCat;
if (typeof ps.injectFeaturedNote === 'boolean') profileUpdates.injectFeaturedNote = ps.injectFeaturedNote;
if (typeof ps.receiveAnnouncementEmail === 'boolean') profileUpdates.receiveAnnouncementEmail = ps.receiveAnnouncementEmail;
if (typeof ps.alwaysMarkNsfw === 'boolean') profileUpdates.alwaysMarkNsfw = ps.alwaysMarkNsfw;
if (ps.avatarId) {