FIX: Make sure the user is an EmberObject. (#53)

User is a plain JSON object due to discourse-chat fetching a flagged message's user differently than other reviewables. While we work on making things consistent, let's make sure the user is always an EmberObject before calling get
on it.
This commit is contained in:
Roman Rizzi 2022-04-26 10:29:35 -03:00 committed by GitHub
parent f93339bd6d
commit 549f46d62c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import I18n from "I18n";
import { showUserNotes } from "discourse/plugins/discourse-user-notes/discourse-user-notes/lib/user-notes";
import { getOwner } from "discourse-common/lib/get-owner";
import { emojiUrlFor } from "discourse/lib/text";
import EmberObject from "@ember/object";
export default {
shouldRender(args, component) {
@ -9,7 +10,7 @@ export default {
},
setupComponent(args, component) {
const model = args.user;
const model = EmberObject.create(args.user);
const userNotesCount = model.get("custom_fields.user_notes_count") || 0;
component.setProperties({
userNotesCount,