mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Refactor code that raises deprecating warnings in Rails 4
This commit is contained in:
parent
cfc4dda9ff
commit
2abfd38aee
3 changed files with 4 additions and 4 deletions
|
@ -89,9 +89,9 @@ class Topic < ActiveRecord::Base
|
|||
|
||||
scope :listable_topics, lambda { where('topics.archetype <> ?', [Archetype.private_message]) }
|
||||
|
||||
scope :by_newest, order('topics.created_at desc, topics.id desc')
|
||||
scope :by_newest, -> { order('topics.created_at desc, topics.id desc') }
|
||||
|
||||
scope :visible, where(visible: true)
|
||||
scope :visible, -> { where(visible: true) }
|
||||
|
||||
scope :created_since, lambda { |time_ago| where('created_at > ?', time_ago) }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ class TopicUser < ActiveRecord::Base
|
|||
belongs_to :topic
|
||||
|
||||
scope :starred_since, lambda { |sinceDaysAgo| where('starred_at > ?', sinceDaysAgo.days.ago) }
|
||||
scope :by_date_starred, group('date(starred_at)').order('date(starred_at)')
|
||||
scope :by_date_starred, -> { group('date(starred_at)').order('date(starred_at)') }
|
||||
|
||||
scope :tracking, lambda { |topic_id|
|
||||
where(topic_id: topic_id)
|
||||
|
|
|
@ -23,7 +23,7 @@ class UserBlocker
|
|||
def hide_posts
|
||||
Post.where(user_id: @user.id).update_all(["hidden = true, hidden_reason_id = COALESCE(hidden_reason_id, ?)", Post.hidden_reasons[:new_user_spam_threshold_reached]])
|
||||
topic_ids = Post.where('user_id = ? and post_number = ?', @user.id, 1).pluck(:topic_id)
|
||||
Topic.update_all({ visible: false }, id: topic_ids) unless topic_ids.empty?
|
||||
Topic.where(id: topic_ids).update_all({ visible: false }) unless topic_ids.empty?
|
||||
end
|
||||
|
||||
def unblock
|
||||
|
|
Loading…
Reference in a new issue