diff --git a/app/logical/post_sets/post.rb b/app/logical/post_sets/post.rb index 975a96b80..bcc92f2ff 100644 --- a/app/logical/post_sets/post.rb +++ b/app/logical/post_sets/post.rb @@ -18,6 +18,10 @@ module PostSets tag_array.slice(0, 25).join(" ").tr("_", " ") end + def unordered_tag_array + tag_array.reject{|tag| tag =~ /\Aorder:\S+/} + end + def has_wiki? is_single_tag? && ::WikiPage.titled(tag_string).exists? end diff --git a/app/presenters/post_set_presenters/post.rb b/app/presenters/post_set_presenters/post.rb index f3ec46540..819682107 100644 --- a/app/presenters/post_set_presenters/post.rb +++ b/app/presenters/post_set_presenters/post.rb @@ -14,7 +14,9 @@ module PostSetPresenters elsif post_set.is_tag_subscription? post_set.tag_subscription_tags elsif post_set.is_single_tag? - related_tags_for_single + related_tags_for_single(post_set.tag_string) + elsif post_set.unordered_tag_array.size == 1 + related_tags_for_single(post_set.unordered_tag_array.first) elsif post_set.tag_string =~ /(?:^|\s)(?:#{Tag::SUBQUERY_METATAGS}):\S+/ calculate_related_tags_from_post_set elsif post_set.is_empty_tag? @@ -36,8 +38,8 @@ module PostSetPresenters RelatedTagCalculator.calculate_from_sample_to_array(post_set.tag_string).map(&:first) end - def related_tags_for_single - tag = Tag.find_by_name(post_set.tag_string.downcase) + def related_tags_for_single(tag_string) + tag = Tag.find_by_name(tag_string.downcase) if tag tag.related_tag_array.map(&:first)