Compare commits

...

1 commit

Author SHA1 Message Date
c03337dbf1 saving work 2024-03-06 17:07:36 -08:00
9 changed files with 90 additions and 1 deletions

View file

@ -2000,6 +2000,8 @@ _time:
minute: "Minute(s)"
hour: "Hour(s)"
day: "Day(s)"
month: "Month(s)"
year: "Year(s)"
_2fa:
alreadyRegistered: "You have already registered a 2-factor authentication device."
registerTOTP: "Register authenticator app"

View file

@ -0,0 +1,13 @@
export class NoteSelfDestructInterval1709530777533 {
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE user_profile ADD "noteSelfDestructInterval" interval NOT NULL DEFAULT '1 months';`);
await queryRunner.query(`ALTER TABLE user_profile ADD "noteSelfDestructEnable" boolean NOT NULL DEFAULT false;`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE user_profile DROP COLUMN "noteSelfDestructInterval";`);
await queryRunner.query(`ALTER TABLE user_profile DROP COLUMN "noteSelfDestructEnable";`);
}
}

View file

@ -509,6 +509,8 @@ export class UserEntityService implements OnModuleInit {
mutedWords: profile!.mutedWords,
hardMutedWords: profile!.hardMutedWords,
mutedInstances: profile!.mutedInstances,
noteSelfDestructInterval: profile!.noteSelfDestructInterval,
noteSelfDestructEnable: profile!.noteSelfDestructEnable,
mutingNotificationTypes: [], // 後方互換性のため
notificationRecieveConfig: profile!.notificationRecieveConfig,
emailNotificationTypes: profile!.emailNotificationTypes,

View file

@ -343,3 +343,4 @@ export const descriptionSchema = { type: 'string', minLength: 1, maxLength: 1500
export const locationSchema = { type: 'string', minLength: 1, maxLength: 50 } as const;
export const listenbrainzSchema = { type: "string", minLength: 1, maxLength: 128 } as const;
export const birthdaySchema = { type: 'string', pattern: /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.toString().slice(1, -1) } as const;
export const selfDestructIntervalSchema = { type: 'string', pattern: /^[1-9][0-9]+ (years|months|days|hours|minutes)$/.toString().slice(1, -1) } as const;

View file

@ -277,6 +277,17 @@ export class MiUserProfile {
unlockedAt: number;
}[];
@Column('interval', {
default: '1 months',
})
public noteSelfDestructInterval: string;
@Column('boolean', {
default: false,
})
public noteSelfDestructEnable: string;
//#region Denormalized fields
@Index()
@Column('varchar', {

View file

@ -605,6 +605,14 @@ export const packedMeDetailedOnlySchema = {
nullable: false, optional: false,
},
},
noteSelfDestructInterval: {
type: 'string',
nullable: false, optional: false,
},
noteSelfDestructEnable: {
type: 'boolean',
nullable: false, optional: false,
},
notificationRecieveConfig: {
type: 'object',
nullable: false, optional: false,

View file

@ -88,6 +88,14 @@ export const meta = {
type: 'string',
},
},
noteSelfDestructInterval: {
type: 'string',
optional: false, nullable: false,
},
noteSelfDestructEnable: {
type: 'boolean',
optional: false, nullable: false,
},
notificationRecieveConfig: {
type: 'object',
optional: false, nullable: false,
@ -239,6 +247,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
receiveAnnouncementEmail: profile.receiveAnnouncementEmail,
mutedWords: profile.mutedWords,
mutedInstances: profile.mutedInstances,
noteSelfDestructInterval: profile.noteSelfDestructInterval,
noteSelfDestructEnable: profile.noteSelfDestructEnable,
notificationRecieveConfig: profile.notificationRecieveConfig,
isModerator: isModerator,
isSilenced: isSilenced,

View file

@ -13,7 +13,7 @@ import { extractHashtags } from '@/misc/extract-hashtags.js';
import * as Acct from '@/misc/acct.js';
import type { UsersRepository, DriveFilesRepository, UserProfilesRepository, PagesRepository } from '@/models/_.js';
import type { MiLocalUser, MiUser } from '@/models/User.js';
import { birthdaySchema, listenbrainzSchema, descriptionSchema, locationSchema, nameSchema } from '@/models/User.js';
import { birthdaySchema, listenbrainzSchema, descriptionSchema, locationSchema, nameSchema, selfDestructIntervalSchema } from '@/models/User.js';
import type { MiUserProfile } from '@/models/UserProfile.js';
import { notificationTypes } from '@/types.js';
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
@ -202,6 +202,8 @@ export const paramDef = {
mutedInstances: { type: 'array', items: {
type: 'string',
} },
noteSelfDestructInterval: { ...selfDestructIntervalSchema, nullable: false },
noteSelfDestructEnable: { type: 'boolean', nullable: false },
notificationRecieveConfig: {
type: 'object',
nullable: false,
@ -319,6 +321,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
profileUpdates.hardMutedWords = ps.hardMutedWords;
}
if (ps.mutedInstances !== undefined) profileUpdates.mutedInstances = ps.mutedInstances;
if (ps.noteSelfDestructInterval !== undefined) profileUpdates.noteSelfDestructInterval = ps.noteSelfDestructInterval;
if (ps.noteSelfDestructEnable !== undefined) profileUpdates.noteSelfDestructEnable = ps.noteSelfDestructEnable;
if (ps.notificationRecieveConfig !== undefined) profileUpdates.notificationRecieveConfig = ps.notificationRecieveConfig;
if (typeof ps.isLocked === 'boolean') updates.isLocked = ps.isLocked;
if (typeof ps.isExplorable === 'boolean') updates.isExplorable = ps.isExplorable;

View file

@ -68,13 +68,41 @@ SPDX-License-Identifier: AGPL-3.0-only
</FormSection>
<MkSwitch v-model="keepCw" @update:modelValue="save()">{{ i18n.ts.keepCw }}</MkSwitch>
<FormSection>
<div class="_gaps_m">
<MkFolder>
<template #label>{{ i18n.ts.selfDestructingNotes }}</template>
<div class="_gaps_m">
<MkButton primary @click="save()"><i class="ph-check ph-bold ph-lg"></i> {{ i18n.ts.save }}</MkButton>
<MkSwitch v-model="selfDestructingNotesEnable" manualSave>
{{ i18n.ts.enable }}
<template #caption>{{ i18n.ts._selfDestructingNotes.description }}</template>
</MkSwitch>
<FormSplit :minWidth="200">
<MkInput v-model="selfDestructIntervalAmount" type="number" min="1" small/>
<MkSelect v-model="selfDestructIntervalUnit" small>
<option value="years">{{ i18n.ts._time.year }}</option>
<option value="months">{{ i18n.ts._time.month }}</option>
<option value="days">{{ i18n.ts._time.day }}</option>
<option value="hours">{{ i18n.ts._time.hour }}</option>
</MkSelect>
</FormSplit>
</div>
</MkFolder>
</div>
</FormSection>
</div>
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue';
import MkSwitch from '@/components/MkSwitch.vue';
import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import MkSelect from '@/components/MkSelect.vue';
import FormSplit from '@/components/form/split.vue';
import FormSection from '@/components/form/section.vue';
import MkFolder from '@/components/MkFolder.vue';
import { misskeyApi } from '@/scripts/misskey-api.js';
@ -94,12 +122,18 @@ const hideOnlineStatus = ref($i.hideOnlineStatus);
const publicReactions = ref($i.publicReactions);
const followingVisibility = ref($i.followingVisibility);
const followersVisibility = ref($i.followersVisibility);
const selfDestructingNotesEnable = ref($i.selfDestructingNotesEnable);
const selfDestructIntervalAmount = ref(1);
const selfDestructIntervalUnit = ref('months');
const defaultNoteVisibility = computed(defaultStore.makeGetterSetter('defaultNoteVisibility'));
const defaultNoteLocalOnly = computed(defaultStore.makeGetterSetter('defaultNoteLocalOnly'));
const rememberNoteVisibility = computed(defaultStore.makeGetterSetter('rememberNoteVisibility'));
const keepCw = computed(defaultStore.makeGetterSetter('keepCw'));
//console.log(i)
//[ selfDestructIntervalAmount.value, selfDestructIntervalUnit.value ] = $i.selfDestructingNotesInterval.split(' ');
function save() {
misskeyApi('i/update', {
isLocked: !!isLocked.value,
@ -114,6 +148,10 @@ function save() {
});
}
function saveSelfDestructSettings() {
console.log('done');
}
const headerActions = computed(() => []);
const headerTabs = computed(() => []);