Move to Dependency injection for UserModel
Make model getters private on elements. They can be easily
fetched with `testResolver(fooToken)` in tests.
In addition, get rid of shortcutsService on appContext as it was not
being used anywhere and shortcutsService is already DI.
Release-Notes: skip
Change-Id: I2f565127a3cdb7e79206500550e4313c23a7fb09
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
index 26b9a63..ba3e62f 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
@@ -131,6 +131,7 @@
import {ShortcutController} from '../../lit/shortcut-controller';
import {Key, Modifier, whenVisible} from '../../../utils/dom-util';
import {GrThreadList} from '../gr-thread-list/gr-thread-list';
+import {userModelToken} from '../../../models/user/user-model';
export enum FocusTarget {
ANY = 'any',
@@ -216,8 +217,7 @@
private readonly getChangeModel = resolve(this, changeModelToken);
- // Private but used in tests.
- readonly getCommentsModel = resolve(this, commentsModelToken);
+ private readonly getCommentsModel = resolve(this, commentsModelToken);
// TODO: update type to only ParsedChangeInfo
@property({type: Object})
@@ -397,6 +397,8 @@
private readonly accountsModel = getAppContext().accountsModel;
+ private readonly getUserModel = resolve(this, userModelToken);
+
private latestPatchNum?: PatchSetNumber;
storeTask?: DelayedTask;
@@ -631,7 +633,7 @@
subscribe(
this,
- () => getAppContext().userModel.loggedIn$,
+ () => this.getUserModel().loggedIn$,
isLoggedIn => (this.isLoggedIn = isLoggedIn)
);
subscribe(