tags: some corrupt-tags bug fixes

This commit is contained in:
Tyler Renelle
2013-05-10 18:06:35 +01:00
parent ec87bf82b6
commit eea9a2129f
2 changed files with 9 additions and 5 deletions
+8 -5
View File
@@ -25,15 +25,18 @@ module.exports.app = (appExports, model) ->
appExports.filtersDeleteTag = (e, el) ->
tags = user.get('tags')
tagId = $(el).attr('data-tag-id')
#something got corrupted, let's clear the corrupt tags
unless tagId
user.set 'tags', _.filter( tags, ((t)-> t?.id) )
user.set 'filters', {}
return
model.del "_user.filters.#{tagId}"
_.each tags, (tag, i) ->
if tag.id is tagId
tags.splice(i,1)
model.del "_user.filters.#{tag.id}"
model.remove "_user.tags", i if tag.id is tagId
# remove tag from all tasks
_.each user.get("tasks"), (task) ->
user.del "tasks.#{task.id}.tags.#{tagId}"
model.set "_user.tags", tags , -> browser.resetDom(model)
+1
View File
@@ -187,6 +187,7 @@ viewHelpers = (view) ->
view.fn 'appliedTags', (userTags, taskTags) ->
arr = []
_.each userTags, (t) ->
return unless t?
arr.push(t.name) if taskTags?[t.id]
arr.join(', ')