diff --git a/app/controllers/forum_topics_controller.rb b/app/controllers/forum_topics_controller.rb
index 9aedb4975..5c226d59d 100644
--- a/app/controllers/forum_topics_controller.rb
+++ b/app/controllers/forum_topics_controller.rb
@@ -28,7 +28,7 @@ class ForumTopicsController < ApplicationController
if request.format.atom?
@forum_topics = @forum_topics.includes(:creator, :original_post)
elsif request.format.html?
- @forum_topics = @forum_topics.includes(:creator, :updater, :forum_topic_visit_by_current_user)
+ @forum_topics = @forum_topics.includes(:creator, :updater, :forum_topic_visit_by_current_user, :bulk_update_requests)
end
respond_with(@forum_topics)
diff --git a/app/helpers/forum_topics_helper.rb b/app/helpers/forum_topics_helper.rb
index f96eac9c9..8e537f088 100644
--- a/app/helpers/forum_topics_helper.rb
+++ b/app/helpers/forum_topics_helper.rb
@@ -10,4 +10,12 @@ module ForumTopicsHelper
def new_forum_topic?(topic, read_forum_topics)
!read_forum_topics.map(&:id).include?(topic.id)
end
+
+ def bulk_update_request_counts(topic)
+ requests = []
+ requests << %(Pending: #{topic.pending_bur_count}) if topic.pending_bur_count.positive?
+ requests << %(Approved: #{topic.approved_bur_count}) if topic.approved_bur_count.positive?
+ requests << %(Rejected: #{topic.rejected_bur_count}) if topic.rejected_bur_count.positive?
+ requests.join(" | ").html_safe
+ end
end
diff --git a/app/models/forum_topic.rb b/app/models/forum_topic.rb
index 5274d20f8..8dc394d2e 100644
--- a/app/models/forum_topic.rb
+++ b/app/models/forum_topic.rb
@@ -18,6 +18,7 @@ class ForumTopic < ApplicationRecord
has_one :forum_topic_visit_by_current_user, -> { where(user_id: CurrentUser.id) }, class_name: "ForumTopicVisit"
has_many :moderation_reports, through: :posts
has_one :original_post, -> {order("forum_posts.id asc")}, class_name: "ForumPost", foreign_key: "topic_id", inverse_of: :topic
+ has_many :bulk_update_requests, :foreign_key => "forum_topic_id"
validates_presence_of :title
validates_associated :original_post
@@ -162,6 +163,18 @@ class ForumTopic < ApplicationRecord
original_post&.update_columns(:updater_id => updater.id, :updated_at => Time.now)
end
+ def pending_bur_count
+ bulk_update_requests.select {|request| request.status == "pending"}.size
+ end
+
+ def approved_bur_count
+ bulk_update_requests.select {|request| request.status == "approved"}.size
+ end
+
+ def rejected_bur_count
+ bulk_update_requests.select {|request| request.status == "rejected"}.size
+ end
+
def self.available_includes
[:creator, :updater, :original_post]
end
diff --git a/app/views/forum_topics/_listing.html.erb b/app/views/forum_topics/_listing.html.erb
index 8314e1435..489c8815d 100644
--- a/app/views/forum_topics/_listing.html.erb
+++ b/app/views/forum_topics/_listing.html.erb
@@ -22,13 +22,16 @@
(<%= User.level_string(topic.min_level).downcase %> only)
<% end %>
<% end %>
- <% t.column "Creator" do |topic| %>
+ <% t.column "BURs", width: "20%" do |topic| %>
+ <%= bulk_update_request_counts(topic) %>
+ <% end %>
+ <% t.column "Creator", width: "8%" do |topic| %>
<%= link_to_user topic.creator %>
<% end %>
- <% t.column "Updated by" do |topic| %>
+ <% t.column "Updated by", width: "8%" do |topic| %>
<%= link_to_user topic.updater %>
<% end %>
- <% t.column "Updated at" do |topic| %>
+ <% t.column "Updated at", width: "8%" do |topic| %>
<%= compact_time topic.updated_at %>
<% end %>
<% end %>