diff --git a/app/controllers/tag_subscriptions_controller.rb b/app/controllers/tag_subscriptions_controller.rb index 8de447389..209e429e8 100644 --- a/app/controllers/tag_subscriptions_controller.rb +++ b/app/controllers/tag_subscriptions_controller.rb @@ -30,7 +30,7 @@ class TagSubscriptionsController < ApplicationController @tag_subscription = TagSubscription.find(params[:id]) check_privilege(@tag_subscription) @tag_subscription.update_attributes(params[:tag_subscription]) - respond_with(@tag_subscription) + respond_with(@tag_subscription, :location => tag_subscriptions_path) end def destroy diff --git a/app/logical/post_sets/post.rb b/app/logical/post_sets/post.rb index 25ae7b74a..ecdf879c2 100644 --- a/app/logical/post_sets/post.rb +++ b/app/logical/post_sets/post.rb @@ -20,7 +20,7 @@ module PostSets def has_wiki? tag_array.any? && ::WikiPage.titled(tag_string).exists? end - + def wiki_page if tag_array.any? ::WikiPage.titled(tag_string).first @@ -75,6 +75,18 @@ module PostSets [page.to_i, 1].max end + def is_tag_subscription? + tag_subscription.present? + end + + def tag_subscription + @tag_subscription ||= tag_array.select {|x| x =~ /^sub:/}.map {|x| x.sub(/^sub:/, "")}.first + end + + def tag_subscription_tags + @tag_subscription_tags ||= TagSubscription.find_tags(tag_subscription) + end + def presenter @presenter ||= ::PostSetPresenters::Post.new(self) end diff --git a/app/presenters/post_set_presenters/post.rb b/app/presenters/post_set_presenters/post.rb index 5447d98d1..7fcd27dfd 100644 --- a/app/presenters/post_set_presenters/post.rb +++ b/app/presenters/post_set_presenters/post.rb @@ -11,6 +11,8 @@ module PostSetPresenters def related_tags if post_set.is_pattern_search? pattern_tags + elsif post_set.is_tag_subscription? + post_set.tag_subscription_tags elsif post_set.is_single_tag? related_tags_for_single elsif post_set.is_empty_tag? @@ -48,7 +50,7 @@ module PostSetPresenters return tag.related_tag_array.map(&:first) end end - + def tag_list_html(template) tag_set_presenter.tag_list_html(template) end diff --git a/app/views/tag_subscriptions/posts.html.erb b/app/views/tag_subscriptions/posts.html.erb index 9fa1d8b10..cd8d5f66e 100644 --- a/app/views/tag_subscriptions/posts.html.erb +++ b/app/views/tag_subscriptions/posts.html.erb @@ -2,9 +2,7 @@