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

Previously, it was based on the container of the avatar. However, the
container of the avatar can be extended to contain more than just the
avatar itself. This resulted in the positioning of the avatar flair to
be off.
This commit is contained in:
Alan Guo Xiang Tan 2021-12-09 08:38:39 +08:00 committed by GitHub
parent dea56ed953
commit ae88b52370
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -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));

View File

@ -482,6 +482,7 @@ aside.quote {
}
}
.post-avatar,
.topic-avatar,
.user-card-avatar {
position: relative;