From bb879cc4fd9b6b08db2e90b8a7d0f51dc72cda6a Mon Sep 17 00:00:00 2001 From: Toks Date: Tue, 30 Jun 2015 09:47:20 -0400 Subject: [PATCH] fix -favgroup: for tag scripts, add -fav: --- app/assets/javascripts/tag_script.js | 2 +- app/models/post.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/tag_script.js b/app/assets/javascripts/tag_script.js index 2f753b3b1..2ec63b1db 100644 --- a/app/assets/javascripts/tag_script.js +++ b/app/assets/javascripts/tag_script.js @@ -34,7 +34,7 @@ } } else if (command === "[reset]") { return []; - } else if (command[0] === "-" && !command.match(/^(?:-pool|-parent):/i)) { + } else if (command[0] === "-" && !command.match(/^(?:-pool|-parent|-fav|-favgroup):/i)) { return Danbooru.reject(tags, function(x) {return x === command.substr(1, 100)}); } else { tags.push(command); diff --git a/app/models/post.rb b/app/models/post.rb index 9f3c2b269..3ff3ece6a 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -629,7 +629,7 @@ class Post < ActiveRecord::Base def filter_metatags(tags) @pre_metatags, tags = tags.partition {|x| x =~ /\A(?:rating|parent|-parent):/i} - @post_metatags, tags = tags.partition {|x| x =~ /\A(?:-pool|pool|newpool|fav|child|-favgroup|favgroup):/i} + @post_metatags, tags = tags.partition {|x| x =~ /\A(?:-pool|pool|newpool|fav|-fav|child|-favgroup|favgroup):/i} apply_pre_metatags return tags end @@ -665,6 +665,9 @@ class Post < ActiveRecord::Base when /^fav:(.+)$/i add_favorite!(CurrentUser.user) + when /^-fav:(.+)$/i + remove_favorite!(CurrentUser.user) + when /^child:(.+)$/i child = Post.find($1) child.parent_id = id