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) { ...@@ -116,7 +116,7 @@ function restoreFromDrafts(drafts, permissions, domainModel, vm) {
} else { } else {
domainModel.permissions = permissions.shared(domainModel.group); domainModel.permissions = permissions.shared(domainModel.group);
} }
vm.form.tags = viewModelTagsFromDomainModelTags(draft.tags); vm.form.tags = draft.tags;
vm.form.text = draft.text; vm.form.text = draft.text;
} }
} }
...@@ -140,7 +140,7 @@ function saveToDrafts(drafts, domainModel, vm) { ...@@ -140,7 +140,7 @@ function saveToDrafts(drafts, domainModel, vm) {
domainModel, domainModel,
{ {
isPrivate: vm.isPrivate(), isPrivate: vm.isPrivate(),
tags: domainModelTagsFromViewModelTags(vm.form.tags), tags: vm.form.tags,
text: vm.form.text, text: vm.form.text,
}); });
} }
......
...@@ -1277,7 +1277,7 @@ describe('annotation.js', function() { ...@@ -1277,7 +1277,7 @@ describe('annotation.js', function() {
it('uses the text and tags from the draft if present', function() { it('uses the text and tags from the draft if present', function() {
fakeDrafts.get.returns({ fakeDrafts.get.returns({
tags: ['unsaved-tag'], tags: [{text: 'unsaved-tag'}],
text: 'unsaved-text' text: 'unsaved-text'
}); });
var controller = createDirective().controller; var controller = createDirective().controller;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* the drafts service, they're only used to identify the correct draft to * the drafts service, they're only used to identify the correct draft to
* return. * 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 * which are the user's draft changes to the annotation. These are returned
* from the drafts service by `drafts.get()`. * 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