Discourse Show Fullname in Mentions

Did you rebake your posts?

1 Like

Thanks! Now I did. Would searching groups also be possible? I have my trust_level_0 group named as everyone. If the plugin could also use the full name for the group mentions, this would be a cool way to make global trust_level_0 mentions look like an everyone mention.

It does now (you have to update the component also).

Unfortunately, the group name link will not open the group when clicked.

1 Like

Since the plugin includes the info while baking the posts. Be aware that if the user updates the full name, it won’t be updated in the post unless the post is rebaked.

I need to update a few things in this theme-component. Removing the Ajax calls is now possible if the user status is enabled.

Will try to do it soon.

2 Likes

Exactly. It should watch user and group name changes:

2 Likes

Rebaking is expensive. This can be problematic in some communities, depending on how frequently the users change their names.

Keep this in mind.

1 Like

Thanks. In our more formal school community the names will not change frequently.

In principle, the names could be added while shipping already baked content. It seems, you would prefer this path?

It works mostly. I am not sure why but even though I have trust level 0 renamed to everyone, it doesn’t apply the label to it.


Non trust-level groups all work though and display their full names.

EDIT: Ah, because the full_name column in the groups table does not hold the modified full name value of trust level groups! Checking data explorer, it is null. Hmm?

From the above picture, it seems that you changed i18n entries for trust_level_0.

Try Group.find(10).update! full_name: "TESTTEST" in rails console.

This might have side effects, considering changing full names of built-in groups is not allowed in the UI.

Indeed. I tried this, and it worked without any serious impact. Is there a way to incorporate groups without having to use the plugin and only using the theme component? That’s actually preferred for me since I don’t relish raking if I can avoid it.

Using the component: no, it depends on the plugin.

But you should be able to just rename the handle of the group, since in a German discourse, group 10 is named “vertrauensstufe_0”, not “trust_level_0”. Therefore, you might succeed setting the name to “everybody”.

That makes sense. From a developer’s viewpoint, what does a.mention-group contain or better said, how can I see a.mention-group’s data structure? I am not a Javascript developer by trade but I can work backward programatically well enough. I am attempting to modify @saquetim’s extension to get the data from a.mention-group and a.mention to blend together with Ajax.

OK, I’ve managed to get some time to improve this theme-component this weekend and updated it to v2.0.

It’s much more efficient now.

The v2 of the component includes the following new features:

  • the loading of the users’ data was optimized to make as few Ajax requests as possible, fetching up to 50 users/groups per request.
    It also can leverage the serialized data if the Site Setting enable user statusis enabled. In this case, it will perform Ajax requests only to fetch data for group mentions.
  • Added support to display full names for groups mentions.
  • Added setting to customize how the names are rendered in the mentions
  • Added support to reverse the rendered mentions text back to the original markdown when quoting.

The new version requires a pretty recent feature is Discourse, so you need to update Discourse at least to 3.2.0.beta2.

@Hifihedgehog, @thoka if you want to try it. Please let me know if you encounter some issue.

6 Likes

I have one minor issue. I can see the full or display name for user mentions in the suggestion bar but I don’t see it in the post. See below. I do see the full or display name for group mentions in both the suggestion bar and in posts. See also below. So bottom line, the full name appears to be showing for group mentions across the board but not for user mentions and specifically only in the posted content.

This is quite weird.|

Did you update your Discourse instance lately? It needs a very recent feature.

Furthermore, are there any errors in the console?

Yes, I am on the latest update as of this morning. I updated per your instructions though I was already on 3.2.0.beta2. So I am now on 3.2.0.beta3-dev. No errors that I can see in sidekiq.

I mean, the browser console. Sorry.

Can you open the browser DevTools and check if there are some errors?

@Hifihedgehog, there was a bug when handling usernames that were not fully lowercase. Can you update the component later and try again?

Yes, all working from my end! Thank you for the quick turnaround! :smiley:

1 Like