FIX: model might be a POJO and not a post model

This commit is contained in:
Joffrey JAFFEUX 2019-12-03 11:51:35 +01:00
parent 60f7aa62bd
commit 2f2cbd1e11
1 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import { h } from "virtual-dom";
import { iconHTML } from "discourse-common/lib/icon-library";
import { queryRegistry } from "discourse/widgets/widget";
import { getOwner } from "discourse-common/lib/get-owner";
import { get } from "@ember/object";
function registerTopicFooterButtons(api) {
api.registerTopicFooterButton({
@ -233,11 +234,11 @@ function initialize(api) {
if (dec.attrs.post_number === 1) {
const postModel = dec.getModel();
if (postModel) {
const assignedToUser = postModel.get("topic.assigned_to_user");
const assignedToUser = get(postModel, "topic.assigned_to_user");
if (assignedToUser) {
return dec.widget.attach("assigned-to", {
assignedToUser,
href: postModel.get("topic.assignedToUserPath")
href: get(postModel, "topic.assignedToUserPath")
});
}
}