feat(editor): Add v1 banner (#6443)
This commit is contained in:
committed by
कारतोफ्फेलस्क्रिप्ट™
parent
85372aabdf
commit
0fe415add2
@@ -1,10 +1,23 @@
|
||||
import { Service } from 'typedi';
|
||||
import { DataSource, Repository } from 'typeorm';
|
||||
import { Settings } from '../entities/Settings';
|
||||
import config from '@/config';
|
||||
|
||||
@Service()
|
||||
export class SettingsRepository extends Repository<Settings> {
|
||||
constructor(dataSource: DataSource) {
|
||||
super(Settings, dataSource.manager);
|
||||
}
|
||||
|
||||
async saveSetting(key: string, value: string, loadOnStartup = true) {
|
||||
const setting = await this.findOneBy({ key });
|
||||
|
||||
if (setting) {
|
||||
await this.update({ key }, { value, loadOnStartup });
|
||||
} else {
|
||||
await this.save({ key, value, loadOnStartup });
|
||||
}
|
||||
|
||||
if (loadOnStartup) config.set('ui.banners.v1.dismissed', true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user