Skip to content

Instantly share code, notes, and snippets.

@lefnire
Created August 26, 2014 16:30
Show Gist options
  • Save lefnire/92c73abef1e341cb3615 to your computer and use it in GitHub Desktop.
Save lefnire/92c73abef1e341cb3615 to your computer and use it in GitHub Desktop.
diff --git a/script/index.coffee b/script/index.coffee
index 4f56d19..f81fd44 100644
--- a/script/index.coffee
+++ b/script/index.coffee
@@ -507,6 +507,7 @@ api.wrap = (user, main=true) ->
sortTask: (req, cb) ->
{id} = req.params
{to, from} = req.query
+ return cb?() if to is from
task = user.tasks[id]
return cb?({code:404, message: i18n.t('messageTaskNotFound', req.language)}) unless task
return cb?('?to=__&from=__ are required') unless to? and from?
@@ -550,6 +551,7 @@ api.wrap = (user, main=true) ->
sortTag: (req, cb) ->
{to, from} = req.query
+ return cb?(null) if to is from
return cb?('?to=__&from=__ are required') unless to? and from?
user.tags.splice to, 0, user.tags.splice(from, 1)[0]
cb? null, user.tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment