Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix flaky specs by explicitly ordering tags (#20097)

Gerhard Schlagerfe4a71848ed8
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index f4b75c2330d..5604b401d29 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -42,6 +42,7 @@ class TagsController < ::ApplicationController
if SiteSetting.tags_listed_by_group
ungrouped_tags = Tag.where("tags.id NOT IN (SELECT tag_id FROM tag_group_memberships)")
ungrouped_tags = ungrouped_tags.used_tags_in_regular_topics(guardian) unless show_all_tags
+ ungrouped_tags = ungrouped_tags.order(:id)
grouped_tag_counts =
TagGroup
@@ -60,6 +61,7 @@ class TagsController < ::ApplicationController
@extras = { tag_groups: grouped_tag_counts }
else
tags = show_all_tags ? Tag.all : Tag.used_tags_in_regular_topics(guardian)
+ tags = tags.order(:id)
unrestricted_tags = DiscourseTagging.filter_visible(tags.where(target_tag_id: nil), guardian)
categories =