calls all the sorting scopes the same way
This commit is contained in:
@@ -27,7 +27,7 @@ class Moderation::CommentsController < Moderation::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def load_comments
|
def load_comments
|
||||||
@comments = Comment.accessible_by(current_ability, :hide).flagged.sorted_for_moderation.includes(:commentable)
|
@comments = Comment.accessible_by(current_ability, :hide).flagged.sort_for_moderation.includes(:commentable)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Moderation::DebatesController < Moderation::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def load_debates
|
def load_debates
|
||||||
@debates = Debate.accessible_by(current_ability, :hide).flagged.sorted_for_moderation
|
@debates = Debate.accessible_by(current_ability, :hide).flagged.sort_for_moderation
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Comment < ActiveRecord::Base
|
|||||||
|
|
||||||
scope :recent, -> { order(id: :desc) }
|
scope :recent, -> { order(id: :desc) }
|
||||||
|
|
||||||
scope :sorted_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) }
|
scope :sort_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||||
scope :pending_flag_review, -> { where(ignored_flag_at: nil, hidden_at: nil) }
|
scope :pending_flag_review, -> { where(ignored_flag_at: nil, hidden_at: nil) }
|
||||||
scope :with_ignored_flag, -> { where("ignored_flag_at IS NOT NULL AND hidden_at IS NULL") }
|
scope :with_ignored_flag, -> { where("ignored_flag_at IS NOT NULL AND hidden_at IS NULL") }
|
||||||
scope :flagged, -> { where("flags_count > 0") }
|
scope :flagged, -> { where("flags_count > 0") }
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class Debate < ActiveRecord::Base
|
|||||||
|
|
||||||
before_save :calculate_hot_score
|
before_save :calculate_hot_score
|
||||||
|
|
||||||
scope :sorted_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) }
|
scope :sort_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||||
scope :pending_flag_review, -> { where(ignored_flag_at: nil, hidden_at: nil) }
|
scope :pending_flag_review, -> { where(ignored_flag_at: nil, hidden_at: nil) }
|
||||||
scope :with_ignored_flag, -> { where("ignored_flag_at IS NOT NULL AND hidden_at IS NULL") }
|
scope :with_ignored_flag, -> { where("ignored_flag_at IS NOT NULL AND hidden_at IS NULL") }
|
||||||
scope :flagged, -> { where("flags_count > 0") }
|
scope :flagged, -> { where("flags_count > 0") }
|
||||||
|
|||||||
Reference in New Issue
Block a user