diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 44a41ab4a..e2819ec40 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -147,10 +147,10 @@ import { AdminService } from './service/admin.service'; import { AuthnService } from './service/authn.service'; import { ConfigService } from './service/config.service'; import { DebugService } from './service/debug.service'; +import { ModService } from './service/mod.service'; import { OriginMapService } from './service/origin-map.service'; -import { ThemeService } from './service/theme.service'; -const loadFactory = (config: ConfigService, debug: DebugService, authn: AuthnService, admin: AdminService, account: AccountService, origins: OriginMapService, themes: ThemeService) => () => +const loadFactory = (config: ConfigService, debug: DebugService, authn: AuthnService, admin: AdminService, account: AccountService, origins: OriginMapService, themes: ModService) => () => config.load$.pipe( tap(() => console.log('-{1}- Loading Jasper')), switchMap(() => debug.init$), @@ -339,7 +339,7 @@ const loadFactory = (config: ConfigService, debug: DebugService, authn: AuthnSer { provide: APP_INITIALIZER, useFactory: loadFactory, - deps: [ConfigService, DebugService, AuthnService, AdminService, AccountService, OriginMapService, ThemeService], + deps: [ConfigService, DebugService, AuthnService, AdminService, AccountService, OriginMapService, ModService], multi: true, }, ], diff --git a/src/app/component/subscription-bar/subscription-bar.component.ts b/src/app/component/subscription-bar/subscription-bar.component.ts index 875cd0d53..80e427709 100644 --- a/src/app/component/subscription-bar/subscription-bar.component.ts +++ b/src/app/component/subscription-bar/subscription-bar.component.ts @@ -1,13 +1,13 @@ import { Location } from '@angular/common'; import { Component, HostBinding, OnDestroy, OnInit } from '@angular/core'; +import { autorun, IReactionDisposer } from 'mobx'; +import { map } from 'rxjs'; +import { Ext } from '../../model/ext'; import { AdminService } from '../../service/admin.service'; import { ExtService } from '../../service/api/ext.service'; import { ConfigService } from '../../service/config.service'; -import { ThemeService } from '../../service/theme.service'; +import { ModService } from '../../service/mod.service'; import { Store } from '../../store/store'; -import { map } from 'rxjs'; -import { Ext } from '../../model/ext'; -import { autorun, IReactionDisposer } from 'mobx'; @Component({ selector: 'app-subscription-bar', @@ -26,7 +26,7 @@ export class SubscriptionBarComponent implements OnInit, OnDestroy { constructor( public config: ConfigService, public store: Store, - public themes: ThemeService, + public themes: ModService, public admin: AdminService, private exts: ExtService, public location: Location, diff --git a/src/app/page/ext/ext.component.ts b/src/app/page/ext/ext.component.ts index 55076fb08..fd60344ca 100644 --- a/src/app/page/ext/ext.component.ts +++ b/src/app/page/ext/ext.component.ts @@ -11,7 +11,7 @@ import { Ext } from '../../model/ext'; import { tagDeleteNotice } from '../../mods/delete'; import { AdminService } from '../../service/admin.service'; import { ExtService } from '../../service/api/ext.service'; -import { ThemeService } from '../../service/theme.service'; +import { ModService } from '../../service/mod.service'; import { Store } from '../../store/store'; import { scrollToFirstInvalid } from '../../util/form'; import { TAG_SUFFIX_REGEX } from '../../util/format'; @@ -43,14 +43,14 @@ export class ExtPage implements OnInit, OnDestroy, HasChanges { templates = this.admin.tmplSubmit; constructor( - private theme: ThemeService, + private mod: ModService, private admin: AdminService, public router: Router, public store: Store, private exts: ExtService, private fb: UntypedFormBuilder, ) { - theme.setTitle($localize`Edit Tag`); + mod.setTitle($localize`Edit Tag`); this.extForm = fb.group({ tag: ['', [Validators.pattern(TAG_SUFFIX_REGEX)]], }); diff --git a/src/app/page/home/home.component.ts b/src/app/page/home/home.component.ts index 1ade00b98..4fac015f8 100644 --- a/src/app/page/home/home.component.ts +++ b/src/app/page/home/home.component.ts @@ -5,7 +5,7 @@ import { Ext } from '../../model/ext'; import { AccountService } from '../../service/account.service'; import { AdminService } from '../../service/admin.service'; import { ExtService } from '../../service/api/ext.service'; -import { ThemeService } from '../../service/theme.service'; +import { ModService } from '../../service/mod.service'; import { QueryStore } from '../../store/query'; import { Store } from '../../store/store'; import { getArgs } from '../../util/query'; @@ -22,14 +22,14 @@ export class HomePage implements OnInit, OnDestroy { activeExts: Ext[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public account: AccountService, public store: Store, public query: QueryStore, private exts: ExtService, ) { - theme.setTitle($localize`Home`); + mod.setTitle($localize`Home`); store.view.clear(!!this.admin.getPlugin('plugin/vote/up') ? 'voteScoreDecay' : 'published'); query.clear(); if (admin.getTemplate('home')) { diff --git a/src/app/page/inbox/alarms/alarms.component.ts b/src/app/page/inbox/alarms/alarms.component.ts index ad2f56595..b95e985da 100644 --- a/src/app/page/inbox/alarms/alarms.component.ts +++ b/src/app/page/inbox/alarms/alarms.component.ts @@ -2,7 +2,7 @@ import { Component, HostBinding, OnDestroy, OnInit } from '@angular/core'; import { defer } from 'lodash-es'; import { autorun, IReactionDisposer } from 'mobx'; import { AdminService } from '../../../service/admin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -18,12 +18,12 @@ export class InboxAlarmsPage implements OnInit, OnDestroy { private disposers: IReactionDisposer[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public store: Store, public query: QueryStore, ) { - theme.setTitle($localize`Inbox: Alarms`); + mod.setTitle($localize`Inbox: Alarms`); store.view.clear('modified'); query.clear(); } diff --git a/src/app/page/inbox/all/all.component.ts b/src/app/page/inbox/all/all.component.ts index e2c69cfdb..e47d1ec3a 100644 --- a/src/app/page/inbox/all/all.component.ts +++ b/src/app/page/inbox/all/all.component.ts @@ -2,7 +2,7 @@ import { Component, HostBinding, OnDestroy, OnInit } from '@angular/core'; import { defer } from 'lodash-es'; import { autorun, IReactionDisposer } from 'mobx'; import { AdminService } from '../../../service/admin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -18,12 +18,12 @@ export class InboxAllPage implements OnInit, OnDestroy { private disposers: IReactionDisposer[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public store: Store, public query: QueryStore, ) { - theme.setTitle($localize`Inbox: All`); + mod.setTitle($localize`Inbox: All`); store.view.clear('modified'); query.clear(); } diff --git a/src/app/page/inbox/dms/dms.component.ts b/src/app/page/inbox/dms/dms.component.ts index b49093d25..e7bcb2921 100644 --- a/src/app/page/inbox/dms/dms.component.ts +++ b/src/app/page/inbox/dms/dms.component.ts @@ -2,7 +2,7 @@ import { Component, HostBinding, OnDestroy, OnInit } from '@angular/core'; import { defer } from 'lodash-es'; import { autorun, IReactionDisposer } from 'mobx'; import { AdminService } from '../../../service/admin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -18,12 +18,12 @@ export class InboxDmsPage implements OnInit, OnDestroy { private disposers: IReactionDisposer[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public store: Store, public query: QueryStore, ) { - theme.setTitle($localize`Inbox: DMs`); + mod.setTitle($localize`Inbox: DMs`); store.view.clear('modified'); query.clear(); } diff --git a/src/app/page/inbox/modlist/modlist.component.ts b/src/app/page/inbox/modlist/modlist.component.ts index 317e7410d..d1ba88963 100644 --- a/src/app/page/inbox/modlist/modlist.component.ts +++ b/src/app/page/inbox/modlist/modlist.component.ts @@ -2,7 +2,7 @@ import { Component, HostBinding, OnDestroy, OnInit } from '@angular/core'; import { defer } from 'lodash-es'; import { autorun, IReactionDisposer } from 'mobx'; import { AdminService } from '../../../service/admin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -18,12 +18,12 @@ export class InboxModlistPage implements OnInit, OnDestroy { private disposers: IReactionDisposer[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public store: Store, public query: QueryStore, ) { - theme.setTitle($localize`Inbox: Modlist`); + mod.setTitle($localize`Inbox: Modlist`); store.view.clear('modified'); query.clear(); } diff --git a/src/app/page/inbox/sent/sent.component.ts b/src/app/page/inbox/sent/sent.component.ts index 57ed5db67..3a82892e1 100644 --- a/src/app/page/inbox/sent/sent.component.ts +++ b/src/app/page/inbox/sent/sent.component.ts @@ -2,7 +2,7 @@ import { Component, HostBinding, OnDestroy, OnInit } from '@angular/core'; import { defer } from 'lodash-es'; import { autorun, IReactionDisposer } from 'mobx'; import { AdminService } from '../../../service/admin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -18,12 +18,12 @@ export class InboxSentPage implements OnInit, OnDestroy { private disposers: IReactionDisposer[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public store: Store, public query: QueryStore, ) { - theme.setTitle($localize`Inbox: Sent`); + mod.setTitle($localize`Inbox: Sent`); store.view.clear(); query.clear(); } diff --git a/src/app/page/inbox/unread/unread.component.ts b/src/app/page/inbox/unread/unread.component.ts index f894cbe30..9cc100411 100644 --- a/src/app/page/inbox/unread/unread.component.ts +++ b/src/app/page/inbox/unread/unread.component.ts @@ -1,13 +1,13 @@ import { Component, HostBinding, OnDestroy, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; import { defer } from 'lodash-es'; import { autorun, IReactionDisposer } from 'mobx'; import { RefPageArgs } from '../../../model/ref'; import { newest } from '../../../mods/mailbox'; import { AccountService } from '../../../service/account.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; -import { Router } from '@angular/router'; @Component({ selector: 'app-unread', @@ -21,13 +21,13 @@ export class InboxUnreadPage implements OnInit, OnDestroy { private lastNotified?: moment.Moment; constructor( - private theme: ThemeService, + private mod: ModService, public store: Store, public query: QueryStore, private account: AccountService, private router: Router, ) { - theme.setTitle($localize`Inbox: Unread`); + mod.setTitle($localize`Inbox: Unread`); store.view.clear('modified'); query.clear(); } diff --git a/src/app/page/ref/alts/alts.component.ts b/src/app/page/ref/alts/alts.component.ts index 56ec0dde0..b2b84e72a 100644 --- a/src/app/page/ref/alts/alts.component.ts +++ b/src/app/page/ref/alts/alts.component.ts @@ -4,7 +4,7 @@ import { autorun, IReactionDisposer, runInAction } from 'mobx'; import { Page } from '../../../model/page'; import { Ref } from '../../../model/ref'; import { AdminService } from '../../../service/admin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -21,7 +21,7 @@ export class RefAltsComponent implements OnInit, OnDestroy { page: Page = Page.of([]); constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public store: Store, public query: QueryStore, @@ -60,7 +60,7 @@ export class RefAltsComponent implements OnInit, OnDestroy { }; })); this.disposers.push(autorun(() => { - this.theme.setTitle($localize`Alternate URLs: ` + (this.store.view.ref?.title || this.store.view.url)); + this.mod.setTitle($localize`Alternate URLs: ` + (this.store.view.ref?.title || this.store.view.url)); })); } diff --git a/src/app/page/ref/comments/comments.component.ts b/src/app/page/ref/comments/comments.component.ts index 7ec8f8041..ed3ce9251 100644 --- a/src/app/page/ref/comments/comments.component.ts +++ b/src/app/page/ref/comments/comments.component.ts @@ -5,7 +5,7 @@ import { Subject } from 'rxjs'; import { Ref } from '../../../model/ref'; import { getMailbox, mailboxes } from '../../../mods/mailbox'; import { AdminService } from '../../../service/admin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { Store } from '../../../store/store'; import { ThreadStore } from '../../../store/thread'; import { hasTag, removeTag, top } from '../../../util/tag'; @@ -20,7 +20,7 @@ export class RefCommentsComponent implements OnInit, OnDestroy { newComments$ = new Subject(); constructor( - private theme: ThemeService, + private mod: ModService, public store: Store, public thread: ThreadStore, private admin: AdminService, @@ -30,7 +30,7 @@ export class RefCommentsComponent implements OnInit, OnDestroy { } ngOnInit(): void { - this.disposers.push(autorun(() => this.theme.setTitle($localize`Comments: ` + (this.store.view.ref?.title || this.store.view.url)))); + this.disposers.push(autorun(() => this.mod.setTitle($localize`Comments: ` + (this.store.view.ref?.title || this.store.view.url)))); this.disposers.push(autorun(() => { const top = this.store.view.ref!; const sort = this.store.view.sort; diff --git a/src/app/page/ref/responses/responses.component.ts b/src/app/page/ref/responses/responses.component.ts index de84a099a..89a02e59f 100644 --- a/src/app/page/ref/responses/responses.component.ts +++ b/src/app/page/ref/responses/responses.component.ts @@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { defer, uniq } from 'lodash-es'; import { autorun, IReactionDisposer, runInAction } from 'mobx'; import { AdminService } from '../../../service/admin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -17,7 +17,7 @@ export class RefResponsesComponent implements OnInit, OnDestroy { private disposers: IReactionDisposer[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public store: Store, public query: QueryStore, @@ -40,7 +40,7 @@ export class RefResponsesComponent implements OnInit, OnDestroy { defer(() => this.query.setArgs(args)); })); this.disposers.push(autorun(() => { - this.theme.setTitle($localize`Responses: ` + (this.store.view.ref?.title || this.store.view.url)); + this.mod.setTitle($localize`Responses: ` + (this.store.view.ref?.title || this.store.view.url)); })); } diff --git a/src/app/page/ref/sources/sources.component.ts b/src/app/page/ref/sources/sources.component.ts index e26b36901..4dd24144a 100644 --- a/src/app/page/ref/sources/sources.component.ts +++ b/src/app/page/ref/sources/sources.component.ts @@ -4,7 +4,7 @@ import { autorun, IReactionDisposer, runInAction } from 'mobx'; import { Page } from '../../../model/page'; import { Ref } from '../../../model/ref'; import { AdminService } from '../../../service/admin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -21,7 +21,7 @@ export class RefSourcesComponent implements OnInit, OnDestroy { page: Page = Page.of([]); constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public store: Store, public query: QueryStore, @@ -56,7 +56,7 @@ export class RefSourcesComponent implements OnInit, OnDestroy { } })); this.disposers.push(autorun(() => { - this.theme.setTitle($localize`Sources: ` + (this.store.view.ref?.title || this.store.view.url)); + this.mod.setTitle($localize`Sources: ` + (this.store.view.ref?.title || this.store.view.url)); })); } diff --git a/src/app/page/ref/summary/summary.component.ts b/src/app/page/ref/summary/summary.component.ts index 6f2df1c67..d103806b3 100644 --- a/src/app/page/ref/summary/summary.component.ts +++ b/src/app/page/ref/summary/summary.component.ts @@ -6,7 +6,7 @@ import { Ref } from '../../../model/ref'; import { getMailbox, mailboxes } from '../../../mods/mailbox'; import { AdminService } from '../../../service/admin.service'; import { RefService } from '../../../service/api/ref.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { ThreadStore } from '../../../store/thread'; @@ -25,7 +25,7 @@ export class RefSummaryComponent implements OnInit, OnDestroy { summaryItems = 5; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public refs: RefService, public store: Store, @@ -38,7 +38,7 @@ export class RefSummaryComponent implements OnInit, OnDestroy { } ngOnInit(): void { - this.disposers.push(autorun(() => this.theme.setTitle((this.store.view.ref?.title || this.store.view.url)))); + this.disposers.push(autorun(() => this.mod.setTitle((this.store.view.ref?.title || this.store.view.url)))); this.disposers.push(autorun(() => { const top = this.store.view.ref!; const sort = this.store.view.sort; diff --git a/src/app/page/ref/thread/thread.component.ts b/src/app/page/ref/thread/thread.component.ts index 637e543fb..10a024d49 100644 --- a/src/app/page/ref/thread/thread.component.ts +++ b/src/app/page/ref/thread/thread.component.ts @@ -2,14 +2,13 @@ import { Component, HostBinding } from '@angular/core'; import { defer, uniq } from 'lodash-es'; import { autorun, IReactionDisposer, runInAction } from 'mobx'; import { Subject, Subscription, switchMap, takeUntil } from 'rxjs'; -import { tap } from 'rxjs/operators'; import { Ref } from '../../../model/ref'; import { getMailbox, mailboxes } from '../../../mods/mailbox'; import { AdminService } from '../../../service/admin.service'; import { RefService } from '../../../service/api/ref.service'; import { StompService } from '../../../service/api/stomp.service'; import { ConfigService } from '../../../service/config.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -32,7 +31,7 @@ export class RefThreadComponent { constructor( public config: ConfigService, - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public store: Store, public query: QueryStore, @@ -57,7 +56,7 @@ export class RefThreadComponent { defer(() => this.query.setArgs(args)); })); this.disposers.push(autorun(() => { - this.theme.setTitle($localize`Thread: ` + (this.store.view.ref?.title || this.store.view.url)); + this.mod.setTitle($localize`Thread: ` + (this.store.view.ref?.title || this.store.view.url)); })); this.disposers.push(autorun(() => { if (this.store.view.top && this.config.websockets) { diff --git a/src/app/page/ref/versions/versions.component.ts b/src/app/page/ref/versions/versions.component.ts index baf0dfa19..ec9faac0f 100644 --- a/src/app/page/ref/versions/versions.component.ts +++ b/src/app/page/ref/versions/versions.component.ts @@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { defer } from 'lodash-es'; import { autorun, IReactionDisposer, runInAction } from 'mobx'; import { AdminService } from '../../../service/admin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -17,7 +17,7 @@ export class RefVersionsComponent implements OnInit, OnDestroy { private disposers: IReactionDisposer[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, public store: Store, public query: QueryStore, @@ -41,7 +41,7 @@ export class RefVersionsComponent implements OnInit, OnDestroy { defer(() => this.query.setArgs(args)); })); this.disposers.push(autorun(() => { - this.theme.setTitle($localize`Remotes: ` + (this.store.view.ref?.title || this.store.view.url)); + this.mod.setTitle($localize`Remotes: ` + (this.store.view.ref?.title || this.store.view.url)); })); } diff --git a/src/app/page/settings/backup/backup.component.ts b/src/app/page/settings/backup/backup.component.ts index 4cfeec65e..cfea5f8e1 100644 --- a/src/app/page/settings/backup/backup.component.ts +++ b/src/app/page/settings/backup/backup.component.ts @@ -5,7 +5,7 @@ import * as moment from 'moment'; import { catchError, throwError } from 'rxjs'; import { BackupService } from '../../../service/api/backup.service'; import { OriginService } from '../../../service/api/origin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { Store } from '../../../store/store'; import { scrollToFirstInvalid } from '../../../util/form'; import { ORIGIN_REGEX } from '../../../util/format'; @@ -29,13 +29,13 @@ export class SettingsBackupPage implements OnInit { serverError: string[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public store: Store, private backups: BackupService, private origins: OriginService, private fb: UntypedFormBuilder, ) { - theme.setTitle($localize`Settings: Backup & Restore`); + mod.setTitle($localize`Settings: Backup & Restore`); backups.list(this.origin) .subscribe(list => this.list = list.sort().reverse()); this.originForm = fb.group({ diff --git a/src/app/page/settings/plugin/plugin.component.ts b/src/app/page/settings/plugin/plugin.component.ts index 0c2445177..1fafc578f 100644 --- a/src/app/page/settings/plugin/plugin.component.ts +++ b/src/app/page/settings/plugin/plugin.component.ts @@ -5,7 +5,7 @@ import { autorun, IReactionDisposer } from 'mobx'; import { catchError, switchMap, throwError } from 'rxjs'; import { mapPlugin, Plugin } from '../../../model/plugin'; import { PluginService } from '../../../service/api/plugin.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { PluginStore } from '../../../store/plugin'; import { Store } from '../../../store/store'; import { printError } from '../../../util/http'; @@ -24,12 +24,12 @@ export class SettingsPluginPage implements OnInit, OnDestroy { private disposers: IReactionDisposer[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public store: Store, public query: PluginStore, private plugins: PluginService, ) { - theme.setTitle($localize`Settings: Plugins`); + mod.setTitle($localize`Settings: Plugins`); store.view.clear('tag', 'tag'); query.clear(); } diff --git a/src/app/page/settings/ref/ref.component.ts b/src/app/page/settings/ref/ref.component.ts index 0fe7f9d87..77e6e1948 100644 --- a/src/app/page/settings/ref/ref.component.ts +++ b/src/app/page/settings/ref/ref.component.ts @@ -4,7 +4,7 @@ import { autorun, IReactionDisposer } from 'mobx'; import { Plugin } from '../../../model/plugin'; import { AdminService } from '../../../service/admin.service'; import { AuthzService } from '../../../service/authz.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { QueryStore } from '../../../store/query'; import { Store } from '../../../store/store'; import { getArgs } from '../../../util/query'; @@ -21,13 +21,13 @@ export class SettingsRefPage implements OnInit, OnDestroy { writeAccess = false; constructor( - private theme: ThemeService, + private mod: ModService, private admin: AdminService, private auth: AuthzService, public store: Store, public query: QueryStore, ) { - theme.setTitle($localize`Settings: `); + mod.setTitle($localize`Settings: `); store.view.clear('modified'); query.clear(); } @@ -36,7 +36,7 @@ export class SettingsRefPage implements OnInit, OnDestroy { this.disposers.push(autorun(() => { this.plugin = this.admin.getPlugin(this.store.settings.tag); this.writeAccess = this.auth.canAddTag(this.store.settings.tag); - this.theme.setTitle($localize`Settings: ${this.plugin?.config?.settings || this.store.settings.tag}`); + this.mod.setTitle($localize`Settings: ${this.plugin?.config?.settings || this.store.settings.tag}`); const args = getArgs( this.store.settings.tag + (this.store.view.showRemotes ? '' : (this.plugin?.origin || '@')), this.store.view.sort, diff --git a/src/app/page/settings/setup/setup.component.ts b/src/app/page/settings/setup/setup.component.ts index 666f354d8..4681c616d 100644 --- a/src/app/page/settings/setup/setup.component.ts +++ b/src/app/page/settings/setup/setup.component.ts @@ -11,7 +11,7 @@ import { tagDeleteNotice } from '../../../mods/delete'; import { AdminService } from '../../../service/admin.service'; import { PluginService } from '../../../service/api/plugin.service'; import { TemplateService } from '../../../service/api/template.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { Store } from '../../../store/store'; import { scrollToFirstInvalid } from '../../../util/form'; import { configGroups, modId } from '../../../util/format'; @@ -34,13 +34,13 @@ export class SettingsSetupPage implements OnInit { constructor( public admin: AdminService, - private theme: ThemeService, + private mod: ModService, public store: Store, private plugins: PluginService, private templates: TemplateService, private fb: UntypedFormBuilder, ) { - theme.setTitle($localize`Settings: Setup`); + mod.setTitle($localize`Settings: Setup`); this.adminForm = fb.group({ mods: fb.group(mapValues({...this.admin.def.plugins, ...this.admin.def.templates }, p => fb.control(false))), }); diff --git a/src/app/page/settings/template/template.component.ts b/src/app/page/settings/template/template.component.ts index 64179acd7..ec25bcf5a 100644 --- a/src/app/page/settings/template/template.component.ts +++ b/src/app/page/settings/template/template.component.ts @@ -5,7 +5,7 @@ import { autorun, IReactionDisposer } from 'mobx'; import { catchError, switchMap, throwError } from 'rxjs'; import { mapTemplate, Template } from '../../../model/template'; import { TemplateService } from '../../../service/api/template.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { Store } from '../../../store/store'; import { TemplateStore } from '../../../store/template'; import { printError } from '../../../util/http'; @@ -24,12 +24,12 @@ export class SettingsTemplatePage implements OnInit, OnDestroy { private disposers: IReactionDisposer[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public store: Store, public query: TemplateStore, private templates: TemplateService, ) { - theme.setTitle($localize`Settings: Templates`); + mod.setTitle($localize`Settings: Templates`); store.view.clear('tag', 'tag'); query.clear(); } diff --git a/src/app/page/settings/user/user.component.ts b/src/app/page/settings/user/user.component.ts index f6c5ffae2..ed98e7cff 100644 --- a/src/app/page/settings/user/user.component.ts +++ b/src/app/page/settings/user/user.component.ts @@ -3,7 +3,7 @@ import { defer } from 'lodash-es'; import { autorun, IReactionDisposer } from 'mobx'; import { UserService } from '../../../service/api/user.service'; import { ConfigService } from '../../../service/config.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { ProfileStore } from '../../../store/profile'; import { Store } from '../../../store/store'; import { UserStore } from '../../../store/user'; @@ -19,14 +19,14 @@ export class SettingsUserPage implements OnInit, OnDestroy { private disposers: IReactionDisposer[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public config: ConfigService, public store: Store, public users: UserService, public scim: ProfileStore, public query: UserStore, ) { - theme.setTitle($localize`Settings: User Profiles`); + mod.setTitle($localize`Settings: User Profiles`); store.view.clear('tag', 'tag'); scim.clear(); query.clear(); diff --git a/src/app/page/submit/dm/dm.component.ts b/src/app/page/submit/dm/dm.component.ts index ba00148da..4b0f8c95d 100644 --- a/src/app/page/submit/dm/dm.component.ts +++ b/src/app/page/submit/dm/dm.component.ts @@ -15,7 +15,7 @@ import { RefService } from '../../../service/api/ref.service'; import { BookmarkService } from '../../../service/bookmark.service'; import { ConfigService } from '../../../service/config.service'; import { EditorService } from '../../../service/editor.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { Store } from '../../../store/store'; import { scrollToFirstInvalid } from '../../../util/form'; import { QUALIFIED_TAG_REGEX } from '../../../util/format'; @@ -52,7 +52,7 @@ export class SubmitDmPage implements AfterViewInit, OnDestroy, HasChanges { constructor( private config: ConfigService, - private theme: ThemeService, + private mod: ModService, public admin: AdminService, private router: Router, public store: Store, @@ -61,7 +61,7 @@ export class SubmitDmPage implements AfterViewInit, OnDestroy, HasChanges { private editor: EditorService, private fb: UntypedFormBuilder, ) { - theme.setTitle($localize`Submit: Direct Message`); + mod.setTitle($localize`Submit: Direct Message`); this.dmForm = fb.group({ to: ['', [Validators.pattern(QUALIFIED_TAG_REGEX)]], title: [''], diff --git a/src/app/page/submit/invoice/invoice.component.ts b/src/app/page/submit/invoice/invoice.component.ts index ea7c71cad..e912a0a76 100644 --- a/src/app/page/submit/invoice/invoice.component.ts +++ b/src/app/page/submit/invoice/invoice.component.ts @@ -12,7 +12,7 @@ import { AdminService } from '../../../service/admin.service'; import { ExtService } from '../../../service/api/ext.service'; import { RefService } from '../../../service/api/ref.service'; import { EditorService } from '../../../service/editor.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { Store } from '../../../store/store'; import { scrollToFirstInvalid } from '../../../util/form'; import { templates, URI_REGEX } from '../../../util/format'; @@ -36,7 +36,7 @@ export class SubmitInvoicePage implements OnInit, HasChanges { plugins: string[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, private router: Router, private route: ActivatedRoute, @@ -46,7 +46,7 @@ export class SubmitInvoicePage implements OnInit, HasChanges { private exts: ExtService, private fb: UntypedFormBuilder, ) { - theme.setTitle($localize`Submit: Invoice`); + mod.setTitle($localize`Submit: Invoice`); this.invoiceForm = fb.group({ url: ['', [Validators.required, Validators.pattern(URI_REGEX)]], title: ['', [Validators.required]], diff --git a/src/app/page/submit/submit.component.ts b/src/app/page/submit/submit.component.ts index 4fcc53e03..7c1742b77 100644 --- a/src/app/page/submit/submit.component.ts +++ b/src/app/page/submit/submit.component.ts @@ -20,7 +20,7 @@ import { isWiki, wikiUriFormat } from '../../mods/wiki'; import { AdminService } from '../../service/admin.service'; import { RefService } from '../../service/api/ref.service'; import { AuthzService } from '../../service/authz.service'; -import { ThemeService } from '../../service/theme.service'; +import { ModService } from '../../service/mod.service'; import { Store } from '../../store/store'; import { URI_REGEX } from '../../util/format'; import { fixUrl } from '../../util/http'; @@ -49,14 +49,14 @@ export class SubmitPage implements OnInit, OnDestroy { constructor( public admin: AdminService, - private theme: ThemeService, + private mod: ModService, private router: Router, public store: Store, private auth: AuthzService, private refs: RefService, private fb: UntypedFormBuilder, ) { - theme.setTitle($localize`Submit: Link`); + mod.setTitle($localize`Submit: Link`); this.submitForm = fb.group({ url: ['', [Validators.required], [this.validator]], scrape: [true], diff --git a/src/app/page/submit/text/text.component.ts b/src/app/page/submit/text/text.component.ts index 5b7e6b0ca..ac34313a3 100644 --- a/src/app/page/submit/text/text.component.ts +++ b/src/app/page/submit/text/text.component.ts @@ -18,7 +18,7 @@ import { RefService } from '../../../service/api/ref.service'; import { TaggingService } from '../../../service/api/tagging.service'; import { BookmarkService } from '../../../service/bookmark.service'; import { EditorService } from '../../../service/editor.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { Store } from '../../../store/store'; import { scrollToFirstInvalid } from '../../../util/form'; import { printError } from '../../../util/http'; @@ -48,7 +48,7 @@ export class SubmitTextPage implements AfterViewInit, OnDestroy, HasChanges { private oldSubmit: string[] = []; constructor( - private theme: ThemeService, + private mod: ModService, public admin: AdminService, private router: Router, public store: Store, @@ -58,7 +58,7 @@ export class SubmitTextPage implements AfterViewInit, OnDestroy, HasChanges { private ts: TaggingService, private fb: UntypedFormBuilder, ) { - theme.setTitle($localize`Submit: Text Post`); + mod.setTitle($localize`Submit: Text Post`); this.textForm = refForm(fb); runInAction(() => store.submit.wikiPrefix = admin.getWikiPrefix()); } @@ -75,7 +75,7 @@ export class SubmitTextPage implements AfterViewInit, OnDestroy, HasChanges { let url = this.store.submit.url || 'comment:' + uuid(); if (!this.admin.isWikiExternal() && this.store.submit.wiki) { url = wikiUriFormat(url, this.admin.getWikiPrefix()); - this.theme.setTitle($localize`Submit: Wiki`); + this.mod.setTitle($localize`Submit: Wiki`); this.title.setValue(wikiTitleFormat(url, this.admin.getWikiPrefix())); this.title.disable(); } diff --git a/src/app/page/submit/upload/upload.component.ts b/src/app/page/submit/upload/upload.component.ts index 02051da72..a16fe9a6a 100644 --- a/src/app/page/submit/upload/upload.component.ts +++ b/src/app/page/submit/upload/upload.component.ts @@ -16,7 +16,7 @@ import { RefService } from '../../../service/api/ref.service'; import { ScrapeService } from '../../../service/api/scrape.service'; import { AuthzService } from '../../../service/authz.service'; import { BookmarkService } from '../../../service/bookmark.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { Store } from '../../../store/store'; import { downloadSet } from '../../../util/download'; import { TAGS_REGEX } from '../../../util/format'; @@ -40,7 +40,7 @@ export class UploadPage implements OnDestroy { constructor( public store: Store, public bookmarks: BookmarkService, - private theme: ThemeService, + private mod: ModService, private admin: AdminService, private refs: RefService, private exts: ExtService, @@ -49,7 +49,7 @@ export class UploadPage implements OnDestroy { private router: Router, private fb: FormBuilder, ) { - theme.setTitle($localize`Submit: Upload`); + mod.setTitle($localize`Submit: Upload`); this.disposers.push(autorun(() => { this.readUploads(this.store.submit.files); defer(() => this.store.submit.clearFiles()); diff --git a/src/app/page/submit/web/web.component.ts b/src/app/page/submit/web/web.component.ts index 5e54cfd55..b7447b933 100644 --- a/src/app/page/submit/web/web.component.ts +++ b/src/app/page/submit/web/web.component.ts @@ -17,7 +17,7 @@ import { ScrapeService } from '../../../service/api/scrape.service'; import { TaggingService } from '../../../service/api/tagging.service'; import { AuthzService } from '../../../service/authz.service'; import { EditorService } from '../../../service/editor.service'; -import { ThemeService } from '../../../service/theme.service'; +import { ModService } from '../../../service/mod.service'; import { OembedStore } from '../../../store/oembed'; import { Store } from '../../../store/store'; import { scrollToFirstInvalid } from '../../../util/form'; @@ -46,7 +46,7 @@ export class SubmitWebPage implements AfterViewInit, OnDestroy, HasChanges { private rssUrl?: string; constructor( - private theme: ThemeService, + private mod: ModService, private admin: AdminService, private auth: AuthzService, private router: Router, @@ -172,7 +172,7 @@ export class SubmitWebPage implements AfterViewInit, OnDestroy, HasChanges { setTitle(title: string) { this.title = title; - this.theme.setTitle(title); + this.mod.setTitle(title); } addTag(...values: string[]) { diff --git a/src/app/page/tag/tag.component.ts b/src/app/page/tag/tag.component.ts index abce749dc..bf4186e25 100644 --- a/src/app/page/tag/tag.component.ts +++ b/src/app/page/tag/tag.component.ts @@ -4,7 +4,7 @@ import { autorun, IReactionDisposer, runInAction } from 'mobx'; import { AccountService } from '../../service/account.service'; import { AdminService } from '../../service/admin.service'; import { ExtService } from '../../service/api/ext.service'; -import { ThemeService } from '../../service/theme.service'; +import { ModService } from '../../service/mod.service'; import { QueryStore } from '../../store/query'; import { Store } from '../../store/store'; import { getArgs, UrlFilter } from '../../util/query'; @@ -29,10 +29,10 @@ export class TagPage implements OnInit, OnDestroy { public account: AccountService, public store: Store, public query: QueryStore, - private theme: ThemeService, + private mod: ModService, private exts: ExtService, ) { - this.disposers.push(autorun(() => this.theme.setTitle(this.store.view.name))); + this.disposers.push(autorun(() => this.mod.setTitle(this.store.view.name))); runInAction(() => { this.store.view.clear( !!this.admin.getPlugin('plugin/vote/up') ? 'voteScoreDecay' diff --git a/src/app/page/tags/tags.component.ts b/src/app/page/tags/tags.component.ts index db1dd4192..c6e6e5be4 100644 --- a/src/app/page/tags/tags.component.ts +++ b/src/app/page/tags/tags.component.ts @@ -3,7 +3,7 @@ import { defer } from 'lodash-es'; import { autorun, IReactionDisposer } from 'mobx'; import { AdminService } from '../../service/admin.service'; import { AuthzService } from '../../service/authz.service'; -import { ThemeService } from '../../service/theme.service'; +import { ModService } from '../../service/mod.service'; import { ExtStore } from '../../store/ext'; import { Store } from '../../store/store'; import { getTagFilter, getTagQueryFilter } from '../../util/query'; @@ -23,13 +23,13 @@ export class TagsPage implements OnInit, OnDestroy { templates = this.admin.tmplSubmit.filter(t => t.config?.view); constructor( - private theme: ThemeService, + private mod: ModService, private admin: AdminService, public store: Store, public query: ExtStore, private auth: AuthzService, ) { - theme.setTitle($localize`Tags`); + mod.setTitle($localize`Tags`); store.view.clear('modified,DESC', 'name,ASC'); query.clear(); } diff --git a/src/app/page/user/user.component.ts b/src/app/page/user/user.component.ts index bb151f534..3a71b7cb9 100644 --- a/src/app/page/user/user.component.ts +++ b/src/app/page/user/user.component.ts @@ -12,7 +12,7 @@ import { AdminService } from '../../service/admin.service'; import { ProfileService } from '../../service/api/profile.service'; import { UserService } from '../../service/api/user.service'; import { ConfigService } from '../../service/config.service'; -import { ThemeService } from '../../service/theme.service'; +import { ModService } from '../../service/mod.service'; import { Store } from '../../store/store'; import { scrollToFirstInvalid } from '../../util/form'; import { printError } from '../../util/http'; @@ -35,7 +35,7 @@ export class UserPage implements OnInit, OnDestroy, HasChanges { serverError: string[] = []; constructor( - private theme: ThemeService, + private mod: ModService, private admin: AdminService, public config: ConfigService, public router: Router, @@ -44,7 +44,7 @@ export class UserPage implements OnInit, OnDestroy, HasChanges { private users: UserService, private fb: UntypedFormBuilder, ) { - theme.setTitle($localize`Create Profile`); + mod.setTitle($localize`Create Profile`); this.profileForm = fb.group({ active: [true], password: [''], diff --git a/src/app/service/theme.service.spec.ts b/src/app/service/mod.service.spec.ts similarity index 73% rename from src/app/service/theme.service.spec.ts rename to src/app/service/mod.service.spec.ts index b1c93c5d8..4b3a040a3 100644 --- a/src/app/service/theme.service.spec.ts +++ b/src/app/service/mod.service.spec.ts @@ -2,10 +2,10 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; -import { ThemeService } from './theme.service'; +import { ModService } from './mod.service'; -describe('ThemeService', () => { - let service: ThemeService; +describe('ModService', () => { + let service: ModService; beforeEach(() => { TestBed.configureTestingModule({ @@ -14,7 +14,7 @@ describe('ThemeService', () => { RouterTestingModule, ], }); - service = TestBed.inject(ThemeService); + service = TestBed.inject(ModService); }); it('should be created', () => { diff --git a/src/app/service/theme.service.ts b/src/app/service/mod.service.ts similarity index 99% rename from src/app/service/theme.service.ts rename to src/app/service/mod.service.ts index 9fc63ebaa..40341dbbd 100644 --- a/src/app/service/theme.service.ts +++ b/src/app/service/mod.service.ts @@ -11,7 +11,7 @@ import { ConfigService } from './config.service'; @Injectable({ providedIn: 'root', }) -export class ThemeService { +export class ModService { nesting = CSS.supports('selector(& > *)');