mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 16:03:48 +08:00
b3cda195b8
Lets stop writing the same code over and over again.
22 lines
482 B
Ruby
22 lines
482 B
Ruby
# frozen_string_literal: true
|
|
|
|
class TopicPoster < OpenStruct
|
|
include ActiveModel::Serialization
|
|
|
|
attr_accessor :user, :description, :extras, :id, :primary_group
|
|
|
|
def attributes
|
|
{
|
|
'user' => user,
|
|
'description' => description,
|
|
'extras' => extras,
|
|
'id' => id,
|
|
'primary_group' => primary_group
|
|
}
|
|
end
|
|
|
|
def name_and_description
|
|
I18n.t("js.user.avatar.name_and_description", name: user.display_name, description: description)
|
|
end
|
|
end
|