mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Merge pull request #1826 from nporteschaikin/patch-1
Delegate :username rather than using a class method.
This commit is contained in:
commit
3bbe595d10
1 changed files with 3 additions and 5 deletions
|
@ -51,7 +51,9 @@ class Post < ActiveRecord::Base
|
||||||
scope :public_posts, -> { joins(:topic).where('topics.archetype <> ?', Archetype.private_message) }
|
scope :public_posts, -> { joins(:topic).where('topics.archetype <> ?', Archetype.private_message) }
|
||||||
scope :private_posts, -> { joins(:topic).where('topics.archetype = ?', Archetype.private_message) }
|
scope :private_posts, -> { joins(:topic).where('topics.archetype = ?', Archetype.private_message) }
|
||||||
scope :with_topic_subtype, ->(subtype) { joins(:topic).where('topics.subtype = ?', subtype) }
|
scope :with_topic_subtype, ->(subtype) { joins(:topic).where('topics.subtype = ?', subtype) }
|
||||||
|
|
||||||
|
delegate :username, to: :user
|
||||||
|
|
||||||
def self.hidden_reasons
|
def self.hidden_reasons
|
||||||
@hidden_reasons ||= Enum.new(:flag_threshold_reached, :flag_threshold_reached_again, :new_user_spam_threshold_reached)
|
@hidden_reasons ||= Enum.new(:flag_threshold_reached, :flag_threshold_reached_again, :new_user_spam_threshold_reached)
|
||||||
end
|
end
|
||||||
|
@ -215,10 +217,6 @@ class Post < ActiveRecord::Base
|
||||||
cooked
|
cooked
|
||||||
end
|
end
|
||||||
|
|
||||||
def username
|
|
||||||
user.username
|
|
||||||
end
|
|
||||||
|
|
||||||
def external_id
|
def external_id
|
||||||
"#{topic_id}/#{post_number}"
|
"#{topic_id}/#{post_number}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue