Commit bf029587 authored by Robert Knight's avatar Robert Knight

Tidy up app route initialization in app.js

Tidy up the 'resolve' object to use `// @ngInject` and add a comment to
clarify what it is for.
parent bc6b650e
...@@ -28,30 +28,33 @@ if (settings.raven) { ...@@ -28,30 +28,33 @@ if (settings.raven) {
var mail = require('./vendor/jwz'); var mail = require('./vendor/jwz');
var streamer = require('./streamer'); var streamer = require('./streamer');
var resolve = // Fetch external state that the app needs before it can run. This includes the
// Ensure that we have available a) the current authenticated userid, and b) // authenticated user state, the API endpoint URLs and WebSocket connection.
// the list of user groups. var resolve = {
{ // @ngInject
sessionState: ['session', function (session) { return session.load(); }], sessionState: function (session) {
store: ['store', function (store) { return store.$promise; }], return session.load();
streamer: streamer.connect, },
threading: [ // @ngInject
'annotationMapper', 'drafts', 'threading', store: function (store) {
function (annotationMapper, drafts, threading) { return store.$promise;
// Unload all the annotations },
annotationMapper.unloadAnnotations(threading.annotationList()); streamer: streamer.connect,
// @ngInject
// Reset the threading root threading: function (annotationMapper, drafts, threading) {
threading.createIdTable([]); // Unload all the annotations
threading.root = mail.messageContainer(); annotationMapper.unloadAnnotations(threading.annotationList());
// Reload all new, unsaved annotations // Reset the threading root
threading.thread(drafts.unsaved()); threading.createIdTable([]);
threading.root = mail.messageContainer();
return threading;
} // Reload all new, unsaved annotations
] threading.thread(drafts.unsaved());
};
return threading;
},
};
// @ngInject // @ngInject
function configureLocation($locationProvider) { function configureLocation($locationProvider) {
......
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