FIX: correctly add user info data to message serializer (#20348)

Previous commit https://github.com/discourse/discourse/commit/479c0a3051210da82b127c31088926c4f2a1074a was done with the assumption that this info was defined on user serializer but it was actually defined on post serializer in core. This commit extends the user serializer for messages to add this data to the user.

Also correctly adds serializer test to ensure we actually have this data.
This commit is contained in:
Joffrey JAFFEUX
2023-02-17 17:07:44 +01:00
committed by GitHub
parent c633767b70
commit 8144730ebb
7 changed files with 97 additions and 10 deletions
@@ -135,7 +135,6 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
username: "discobot",
admin: true,
moderator: true,
groupModerator: true,
new_user: true,
primary_group_name: "foo",
},
@@ -147,7 +146,6 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
assert.dom(".chat-message-info__username.is-staff").exists();
assert.dom(".chat-message-info__username.is-admin").exists();
assert.dom(".chat-message-info__username.is-moderator").exists();
assert.dom(".chat-message-info__username.is-category-moderator ").exists();
assert.dom(".chat-message-info__username.is-new-user").exists();
assert.dom(".chat-message-info__username.group--foo").exists();
});
@@ -160,9 +158,6 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
assert.dom(".chat-message-info__username.is-staff").doesNotExist();
assert.dom(".chat-message-info__username.is-admin").doesNotExist();
assert.dom(".chat-message-info__username.is-moderator").doesNotExist();
assert
.dom(".chat-message-info__username.is-category-moderator ")
.doesNotExist();
assert.dom(".chat-message-info__username.is-new-user").doesNotExist();
assert.dom(".chat-message-info__username.group--foo").doesNotExist();
});