Commit fa12712c authored by Sean Hammond's avatar Sean Hammond

Simplify storage of draft tags

These were being converted from view model to domain model format before
being stored in drafts, and back again after being retrieved, which of
course is pointless.
parent 139a2313
......@@ -116,7 +116,7 @@ function restoreFromDrafts(drafts, permissions, domainModel, vm) {
} else {
domainModel.permissions = permissions.shared(domainModel.group);
}
vm.form.tags = viewModelTagsFromDomainModelTags(draft.tags);
vm.form.tags = draft.tags;
vm.form.text = draft.text;
}
}
......@@ -140,7 +140,7 @@ function saveToDrafts(drafts, domainModel, vm) {
domainModel,
{
isPrivate: vm.isPrivate(),
tags: domainModelTagsFromViewModelTags(vm.form.tags),
tags: vm.form.tags,
text: vm.form.text,
});
}
......
......@@ -1277,7 +1277,7 @@ describe('annotation.js', function() {
it('uses the text and tags from the draft if present', function() {
fakeDrafts.get.returns({
tags: ['unsaved-tag'],
tags: [{text: 'unsaved-tag'}],
text: 'unsaved-text'
});
var controller = createDirective().controller;
......
......@@ -9,7 +9,7 @@
* the drafts service, they're only used to identify the correct draft to
* return.
*
* 2. `isPrivate` (boolean), `tags` (array of strings) and `text` (string)
* 2. `isPrivate` (boolean), `tags` (array of objects) and `text` (string)
* which are the user's draft changes to the annotation. These are returned
* from the drafts service by `drafts.get()`.
*
......
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