Cannot access to trustLevel "name"


(Alexis Duran) #1

Hi all,

Basically I am trying to accomplish a sort of flair around all the avatars within my platform which by now it is not a problem it is somewhere similar to the work done at: GitHub - tshenry/discourse-trust-level-avatar-flair but they only attach the flair to a single widget within the Discourse app and as expected, there are many others that won’t render that flair.

My real problem is that I have the user object but the trustLevel doesn’t provide me useful info, I have seen within templates statements like: trustLevel.name and I believed that with the user object I was able to do that but instead what I got a key that has “undefined” value:

03

  @computed("trust_level")
  trustLevel(trustLevel) {
    return Discourse.Site.currentProp('trustLevels').findBy('id', parseInt(trustLevel, 10));
  }

I am expecting that ^ method from user modal return something like:

Class {id: 1, name: "basic user", store: Class, __munge: ƒ, __ember1523976819326: null}

keep in mind the testUser is the same used below and return successfully: