Skip to content

Commit feb2402

Browse files
committed
if view link doesn't have doc specified, use current doc
support going to view as a doc (regression from ve3)
1 parent f487c81 commit feb2402

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/directives/mmsViewLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function mmsViewLink(ElementService, UtilsService, $compile, growl, ViewService,
106106
scope.vid = data.id;
107107
} else if (UtilsService.isView(data) || data.type === 'InstanceSpecification') {
108108
if (!docid || docid === '') {
109-
docid = data.id;
109+
docid = ApplicationService.getState().currentDoc;
110110
}
111111
scope.docid = docid;
112112
scope.vid = data.id;

src/services/ViewService.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,14 @@ function ViewService($q, $http, URLService, ElementService, UtilsService, CacheS
913913
var documentOb = result.filter(
914914
(resultOb) => {
915915
return resultOb.id === reqOb.documentId;
916-
})[0];
917-
deferred.resolve(CacheService.put(cacheKey, documentOb, true));
916+
});
917+
if (documentOb.length == 0) { // could be just a view, pretend it's a doc
918+
ElementService.getElement(reqOb, weight, update).then((result) => {
919+
deferred.resolve(result);
920+
}, (reason) => deferred.reject(reason));
921+
} else {
922+
deferred.resolve(CacheService.put(cacheKey, documentOb[0], true));
923+
}
918924
}, (reason) => {
919925
deferred.reject(reason);
920926
});

0 commit comments

Comments
 (0)