Migrate ChangeModel to DI pattern.

The extra check to see whether the view isConnected inside of
untilModelLoaded that only optionally checks connected$ is only there to
satisfy tests. It is not necessary for the application to run correctly.

Change-Id: I866e5b50988917d283280d1a0bd7da3db336c375
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
index c8dab62..dc635db 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -67,6 +67,7 @@
 import {Subject} from 'rxjs';
 import {debounceTime} from 'rxjs/operators';
 import {configModelToken} from '../../../models/config/config-model';
+import {changeModelToken} from '../../../models/change/change-model';
 
 const UNSAVED_MESSAGE = 'Unable to save draft';
 
@@ -231,7 +232,7 @@
 
   private readonly reporting = getAppContext().reportingService;
 
-  private readonly changeModel = getAppContext().changeModel;
+  private readonly getChangeModel = resolve(this, changeModelToken);
 
   // Private but used in tests.
   readonly getCommentsModel = resolve(this, commentsModelToken);
@@ -262,18 +263,6 @@
 
   constructor() {
     super();
-    subscribe(this, this.userModel.account$, x => (this.account = x));
-    subscribe(this, this.userModel.isAdmin$, x => (this.isAdmin = x));
-
-    subscribe(this, this.changeModel.repo$, x => (this.repoName = x));
-    subscribe(this, this.changeModel.changeNum$, x => (this.changeNum = x));
-    subscribe(
-      this,
-      this.autoSaveTrigger$.pipe(debounceTime(AUTO_SAVE_DEBOUNCE_DELAY_MS)),
-      () => {
-        this.autoSave();
-      }
-    );
     this.shortcuts.addLocal({key: Key.ESC}, () => this.handleEsc());
     for (const key of ['s', Key.ENTER]) {
       for (const modifier of [Modifier.CTRL_KEY, Modifier.META_KEY]) {
@@ -291,6 +280,22 @@
       this.configModel().repoCommentLinks$,
       x => (this.commentLinks = x)
     );
+    subscribe(this, this.userModel.account$, x => (this.account = x));
+    subscribe(this, this.userModel.isAdmin$, x => (this.isAdmin = x));
+
+    subscribe(this, this.getChangeModel().repo$, x => (this.repoName = x));
+    subscribe(
+      this,
+      this.getChangeModel().changeNum$,
+      x => (this.changeNum = x)
+    );
+    subscribe(
+      this,
+      this.autoSaveTrigger$.pipe(debounceTime(AUTO_SAVE_DEBOUNCE_DELAY_MS)),
+      () => {
+        this.autoSave();
+      }
+    );
   }
 
   override disconnectedCallback() {