Migrate change-model to new pattern
- Rename service to model on appContext
- Merge ...-model.ts and ...-service.ts
- Rename ...Servcie to ...Model
- Move all observables onto ...Model
- Inject ...Model in the models and components that were
directly accessing the observables
Google-Bug-Id: b/206459178
Change-Id: I5e719ba747f8b6d67948f1efee53a9a1bcb05d34
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 af2966c..1411c88 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -58,7 +58,6 @@
import {subscribe} from '../../lit/subscription-controller';
import {ShortcutController} from '../../lit/shortcut-controller';
import {classMap} from 'lit/directives/class-map';
-import {changeNum$, repo$} from '../../../services/change/change-model';
import {LineNumber} from '../../../api/diff';
import {CommentSide} from '../../../constants/constants';
import {getRandomInt} from '../../../utils/math-util';
@@ -228,6 +227,8 @@
private readonly reporting = getAppContext().reportingService;
+ private readonly changeModel = getAppContext().changeModel;
+
private readonly commentsModel = getAppContext().commentsModel;
private readonly userModel = getAppContext().userModel;
@@ -263,8 +264,8 @@
this.configModel.repoCommentLinks$,
x => (this.commentLinks = x)
);
- subscribe(this, repo$, x => (this.repoName = x));
- subscribe(this, changeNum$, x => (this.changeNum = 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)),