mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 04:03:45 +08:00
UX: show real name on the about page
This commit is contained in:
parent
ddb8378ab0
commit
b04fae2e2c
|
@ -1,9 +1,7 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend({
|
||||
faqOverriden: function() {
|
||||
return !(this.siteSettings.faq_url.length === 0);
|
||||
}.property(),
|
||||
faqOverriden: Ember.computed.gt('siteSettings.faq_url.length', 0),
|
||||
|
||||
contactInfo: function() {
|
||||
if (Discourse.SiteSettings.contact_email) {
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{{#link-to 'user' user.username}}
|
||||
{{avatar user imageSize="tiny"}}
|
||||
{{user.username}}
|
||||
{{#if user.name}}
|
||||
({{user.name}})
|
||||
{{/if}}
|
||||
{{/link-to}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class AboutSerializer < ApplicationSerializer
|
||||
has_many :moderators, serializer: BasicUserSerializer, embed: :objects
|
||||
has_many :admins, serializer: BasicUserSerializer, embed: :objects
|
||||
has_many :moderators, serializer: UserNameSerializer, embed: :objects
|
||||
has_many :admins, serializer: UserNameSerializer, embed: :objects
|
||||
|
||||
attributes :stats,
|
||||
:description,
|
||||
|
|
20
app/serializers/user_name_serializer.rb
Normal file
20
app/serializers/user_name_serializer.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
class UserNameSerializer < ApplicationSerializer
|
||||
attributes :id, :username, :name, :uploaded_avatar_id, :avatar_template
|
||||
|
||||
def include_name?
|
||||
SiteSetting.enable_names?
|
||||
end
|
||||
|
||||
def avatar_template
|
||||
if Hash === object
|
||||
User.avatar_template(user[:username], user[:uploaded_avatar_id])
|
||||
else
|
||||
object.avatar_template
|
||||
end
|
||||
end
|
||||
|
||||
def user
|
||||
object[:user] || object
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user