mirror of
https://github.com/discourse/discourse.git
synced 2025-03-29 20:25:56 +08:00
Delegate :username rather than using a class method.
This is just a little cleaner?
This commit is contained in:
parent
88d9f3a786
commit
108e7aec9f
@ -52,6 +52,8 @@ class Post < ActiveRecord::Base
|
|||||||
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
|
||||||
@ -206,10 +208,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…
x
Reference in New Issue
Block a user