[FIX] mail: fix reply to author avatar
This PR fixes a bug where the author avatar of the parent message of a reply had the wrong avatar (the one of the of the reply author instead of the one of the parent message author). closes odoo/odoo#118878 Signed-off-by: Debondt Didier (did) <did@odoo.com>
This commit is contained in:
@@ -26,6 +26,9 @@ export class MessageInReply extends Component {
|
||||
) {
|
||||
return url("/mail/static/src/img/email_icon.png");
|
||||
}
|
||||
return this.threadService.avatarUrl(this.message.author, this.props.message.originThread);
|
||||
return this.threadService.avatarUrl(
|
||||
this.message.parentMessage.author,
|
||||
this.props.message.parentMessage.originThread
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,3 +62,31 @@ QUnit.test("click on message in reply to scroll to the parent message", async (a
|
||||
await nextTick();
|
||||
assert.isVisible($(".o-mail-Message:eq(0)"));
|
||||
});
|
||||
|
||||
QUnit.test("reply shows correct author avatar", async (assert) => {
|
||||
const pyEnv = await startServer();
|
||||
const channelId = pyEnv["mail.channel"].create({ name: "general" });
|
||||
const messageId = pyEnv["mail.message"].create({
|
||||
body: "Hey there",
|
||||
message_type: "comment",
|
||||
model: "mail.channel",
|
||||
res_id: channelId,
|
||||
});
|
||||
const partnerId = pyEnv["res.partner"].create({ name: "John Doe" });
|
||||
pyEnv["mail.message"].create({
|
||||
body: "Howdy",
|
||||
message_type: "comment",
|
||||
model: "mail.channel",
|
||||
author_id: partnerId,
|
||||
parent_id: messageId,
|
||||
res_id: channelId,
|
||||
});
|
||||
const { openDiscuss } = await start();
|
||||
await openDiscuss(channelId);
|
||||
const replyAvatar = document.querySelector(".o-mail-MessageInReply-avatar");
|
||||
assert.ok(
|
||||
replyAvatar.dataset["src"].includes(
|
||||
`/mail/channel/${channelId}/partner/${pyEnv.currentPartnerId}/avatar_128`
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user