Commit 4381eab6 authored by Bryce Johnson's avatar Bryce Johnson

Simplify approvals store initialization.

parent d89d0dcf
......@@ -4,10 +4,10 @@
(() => {
let singleton;
class ApprovalsStore {
class MergeRequestApprovalsStore {
constructor(rootStore) {
if (!singleton) {
singleton = gl.ApprovalsStore = this;
singleton = this;
this.init(rootStore);
}
return singleton;
......@@ -63,6 +63,6 @@
return this.rootStore.assignToData(key, data);
}
}
gl.ApprovalsStore = ApprovalsStore;
})();
gl.MergeRequestApprovalsStore = MergeRequestApprovalsStore;
})(window.gl || (window.gl = {}));
......@@ -28,7 +28,7 @@
}
initApprovals() {
gl.ApprovalsStore = new gl.ApprovalsStore(this);
gl.ApprovalsStore = new gl.MergeRequestApprovalsStore(this);
this.assignToData('approvals', {});
}
......
......@@ -8,9 +8,6 @@ $.rails = {
};
(() => {
// store constructor reference, to overwrite ApprovalStore singleton
gl.ApprovalsConstructor = gl.ApprovalsStore;
// stand in for promise returned by api calls
const mockThenable = {
then() {
......@@ -34,7 +31,7 @@ $.rails = {
describe('Approvals Store', function () {
beforeEach(function () {
this.rootStore = mockRootStore;
this.approvalsStore = new gl.ApprovalsConstructor(this.rootStore);
this.approvalsStore = new gl.MergeRequestApprovalsStore(this.rootStore);
});
it('should define all needed approval api calls', function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment