feat: appendHashtag column
This commit is contained in:
parent
8507761272
commit
650af9c5ca
13
migration/1706638834267-appendHashtag.ts
Normal file
13
migration/1706638834267-appendHashtag.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import {MigrationInterface, QueryRunner} from 'typeorm';
|
||||||
|
|
||||||
|
export class appendHashtag1706638834267 implements MigrationInterface {
|
||||||
|
name = 'appendHashtag1706638834267';
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query('ALTER TABLE "user" ADD "appendHashtag" boolean NOT NULL DEFAULT true');
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query('ALTER TABLE "user" DROP COLUMN "appendHashtag"');
|
||||||
|
}
|
||||||
|
}
|
@ -22,4 +22,7 @@ export class UserSetting {
|
|||||||
|
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
useRanking?: boolean;
|
useRanking?: boolean;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
appendHashtag?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,12 @@ export class User implements IUser {
|
|||||||
})
|
})
|
||||||
public useRanking: boolean;
|
public useRanking: boolean;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: 'boolean',
|
||||||
|
default: true,
|
||||||
|
})
|
||||||
|
public appendHashtag: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
|
@ -42,8 +42,12 @@ export const format = (user: IUser, count: Count): string => {
|
|||||||
...getDelta(user, count),
|
...getDelta(user, count),
|
||||||
};
|
};
|
||||||
const template = user.template || defaultTemplate;
|
const template = user.template || defaultTemplate;
|
||||||
return template.replace(variableRegex, (m, name) => {
|
let result = template.replace(variableRegex, (m, name) => {
|
||||||
const v = variables[name];
|
const v = variables[name];
|
||||||
return !v ? m : typeof v === 'function' ? v(score, user) : v;
|
return !v ? m : typeof v === 'function' ? v(score, user) : v;
|
||||||
}) + '\n\n#misshaialert';
|
});
|
||||||
|
if (user.appendHashtag) {
|
||||||
|
result = result + '\n\n#misshaialert'
|
||||||
|
}
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
@ -21,5 +21,6 @@ export interface IUser {
|
|||||||
isAdmin?: boolean;
|
isAdmin?: boolean;
|
||||||
tokenVersion: number;
|
tokenVersion: number;
|
||||||
useRanking: boolean;
|
useRanking: boolean;
|
||||||
|
appendHashtag: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ export const MisshaiPage: React.VFC = () => {
|
|||||||
remoteFollowersOnly: data?.remoteFollowersOnly ?? false,
|
remoteFollowersOnly: data?.remoteFollowersOnly ?? false,
|
||||||
template: data?.template ?? null,
|
template: data?.template ?? null,
|
||||||
useRanking: data?.useRanking ?? false,
|
useRanking: data?.useRanking ?? false,
|
||||||
|
appendHashtag: data?.appendHashtag ?? true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const templateTextarea = useRef<HTMLTextAreaElement>(null);
|
const templateTextarea = useRef<HTMLTextAreaElement>(null);
|
||||||
@ -244,6 +245,12 @@ export const MisshaiPage: React.VFC = () => {
|
|||||||
updateSetting({ useRanking: e.target.checked });
|
updateSetting({ useRanking: e.target.checked });
|
||||||
}}/>
|
}}/>
|
||||||
<span>{t('_missHai.useRanking')}</span>
|
<span>{t('_missHai.useRanking')}</span>
|
||||||
|
</label>
|
||||||
|
<label className="input-check">
|
||||||
|
<input type="checkbox" checked={draft.appendHashtag} onChange={(e) => {
|
||||||
|
updateSetting({ appendHashtag: e.target.checked });
|
||||||
|
}}/>
|
||||||
|
<span>{t('_missHai.appendHashtag')}</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="card pa-2">
|
<div className="card pa-2">
|
||||||
|
Loading…
Reference in New Issue
Block a user