Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: show avatar flair on group, badges and directory pages (#6732)
- Loading branch information
Showing
12 changed files
with
96 additions
and
6 deletions.
There are no files selected for viewing
11 changes: 10 additions & 1 deletion
11
app/assets/javascripts/discourse/templates/components/user-info.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
} | ||
.user-image { | ||
width: 55px; | ||
margin-right: 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module UserPrimaryGroupMixin | ||
|
||
def self.included(klass) | ||
klass.attributes :primary_group_name, | ||
:primary_group_flair_url, | ||
:primary_group_flair_bg_color, | ||
:primary_group_flair_color | ||
end | ||
|
||
def primary_group_name | ||
object&.primary_group&.name | ||
end | ||
|
||
def include_primary_group_name? | ||
object&.primary_group.present? | ||
end | ||
|
||
def primary_group_flair_url | ||
object&.primary_group&.flair_url | ||
end | ||
|
||
def include_primary_group_flair_url? | ||
object&.primary_group&.flair_url.present? | ||
end | ||
|
||
def primary_group_flair_bg_color | ||
object&.primary_group&.flair_bg_color | ||
end | ||
|
||
def include_primary_group_flair_bg_color? | ||
object&.primary_group&.flair_bg_color.present? | ||
end | ||
|
||
def primary_group_flair_color | ||
object&.primary_group&.flair_color | ||
end | ||
|
||
def include_primary_group_flair_color? | ||
object&.primary_group&.flair_color.present? | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
class GroupUserSerializer < BasicUserSerializer | ||
attributes :name, :title, :last_posted_at, :last_seen_at, :added_at | ||
include UserPrimaryGroupMixin | ||
|
||
attributes :name, | ||
:title, | ||
:last_posted_at, | ||
:last_seen_at, | ||
:added_at | ||
|
||
def include_added_at | ||
object.respond_to? :added_at | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1d649e1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit has been mentioned on Discourse Meta. There might be relevant details there:
https://meta.discourse.org/t/avatar-flair-not-showing-up-on-groups-pages/103079/6