Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix position of avatar flair to be based on the actual avatar. (#15226)

Alan Guo Xiang Tanae88b5237086
diff --git a/app/assets/javascripts/discourse/app/widgets/post.js b/app/assets/javascripts/discourse/app/widgets/post.js
index a5f7f4b3b9b..2585a75346e 100644
--- a/app/assets/javascripts/discourse/app/widgets/post.js
+++ b/app/assets/javascripts/discourse/app/widgets/post.js
@@ -186,18 +186,22 @@ createWidget("post-avatar", {
});
}
- const result = [body];
+ const postAvatarBody = [body];
if (attrs.flair_url || attrs.flair_bg_color) {
- result.push(this.attach("avatar-flair", attrs));
+ postAvatarBody.push(this.attach("avatar-flair", attrs));
} else {
const autoFlairAttrs = autoGroupFlairForUser(this.site, attrs);
+
if (autoFlairAttrs) {
- result.push(this.attach("avatar-flair", autoFlairAttrs));
+ postAvatarBody.push(this.attach("avatar-flair", autoFlairAttrs));
}
}
- result.push(h("div.poster-avatar-extra"));
+ const result = [
+ h("div.post-avatar", postAvatarBody),
+ h("div.poster-avatar-extra"),
+ ];
if (this.settings.displayPosterName) {
result.push(this.attach("post-avatar-user-info", attrs));
diff --git a/app/assets/stylesheets/common/base/topic-post.scss b/app/assets/stylesheets/common/base/topic-post.scss
index 60e6621e50b..86771addd8e 100644
--- a/app/assets/stylesheets/common/base/topic-post.scss
+++ b/app/assets/stylesheets/common/base/topic-post.scss
@@ -482,6 +482,7 @@ aside.quote {
}
}
+.post-avatar,
.topic-avatar,
.user-card-avatar {
position: relative;