Full name @mentions

Would we need to go after each fullname on the cooking phase right?

And we need to do this on the server-side cook and the client-side preview?

1 Like

Yeah, that seems to be the problem with that approach, as I just realized I made a few assumptions (incorrectly) based on what I was reading or thought I was reading above.

The issue is we’d have to do a user/group lookup when the post gets cooked for each mention in that given post (groups may be doing this to some extent with its ability to validate mentionableGroups).

Not sure Discourse will be a fan of that, as that could add cost. The current mention_dialect and link-mentions do not do that and only use what comes after @ to determine it is a mention

As you need that fullname property from the username object.

Alternatively, it may be possible to do this via a plugin. The plugin would be a regex replacement, searching for the mention syntax (and then grabbing the user details), and replacing it to contain the full name (you wouldn’t need to use a data attribute for that approach).

So that is two methods, that latter one will need to be done cautiously as you don’t want to disrupt how the usercard determines what user is being clicked on (not sure if it goes on href or the mention text). But I think you can do it without breaking the actual mention and its related tests, if we use one of these approaches.

I was sort of hoping the user data would have been there (was secretly hoping it was somehow using parts of it to help aid the usercard popup), but that doesn’t seem to be the case. If we can make that only apply to the cooking process (and maybe the client side preview), that might be okay.

1 Like

Yes that’s pretty much the problem.

My first approach was re-using the data from the autocomplete, so we wouldn’t put any new pressure on the servers, the data is already there! The problem: where we store this data? It’s just plain old markdown.

The second approach is doing this on the cook method, just adding a data- attribute with the fullname. It’s a user table index seach but I don’t think this will be too much pressure since we have user mention limits in place. The problem: Post will flash after posting when the cooked version comes from server. I could live with that, but Discourse quality bar is higher than mine :stuck_out_tongue:.

1 Like

Perhaps the affiliate plugin may be a good point of reference?
https://meta.discourse.org/t/discourse-affiliate-insert-affiliate-code-amazon-automatically-to-links/19585?u=mcwumbly

1 Like

If you did the Autocomplete route, could you simply put it in parenthesizes after the mention, @cpradio (Full name)? or would you want it clickable?

I still sort of like the data attribute path personally.

1 Like

I think full name mention is better in many cases and near essential in some scenarios.

  • Full names read better in paragraph oriented conversation as opposed to Twitter style 140 character cryptic text.
  • Names rather than IDs are more friendly for not technical people.
  • Languages such a Arabic, Hebrew, Urdu etc. in which text flows right-to-left (RTL) do not look good with mixed in LTR mentions in ASCII/Latin characters; full names in the native language would fit more naturally.
  • Many non-Latin languages require changing keyboard to English just to mention a user then switch back to the native language is a pain; Facebook and XenForo have solved it more elegantly.
3 Likes

Hey all, sorry to bump this one back up again - Did there end up being a solution to replace the @username mention displayed in a post with a users Full Name?

The @ mention search works great finding both usernames and full names, but would be awesome to have an option to replace the @username in a post with the ‘Full Name’ on display. Would love to hear if anyone found a clean way to do this!

I agree with the rationale for sticking with @usernames for mentions.

But do love the suggestion of a tiny avatar image next to the mention:

4 Likes

I am not against experimenting with adding a tiny avatar, but I would like to see the experiment in a plugin first. It is pretty straightforward to add.

8 Likes

I agree that option (perhaps as global setting) to display mention as @sam OR as Sam Saffron would be really great.
With the same formatting as mentions now have, but displaying full name instead of @handle

@codinghorror @sam

So, you guys allow for SSO logins, presumably to allow for companies, anong other entities who maintain master employee/user lists to login with ease.

The issue I’m running into here is this. We have 4500 employees. Most don’t know each other. While tagging by typing name in works perfectly fine, the username displayed is a 5 digit employee #. So now all people see is comeone tagging a 5 digit #

Can you guys write/enable a user option that simply displays the Full Name field in lieu of @username please!

You allow a user option to select the Full Name displayed first in a thread reply with username to the right. A simple visual switch.

I totally get the purpose of using a “twitter” tagging model, but it is severely aggravating for large professional/educational institutions to use. Please, please make an option available. In any means.

It’s not even in a paid hosted/supported version, so you’re missing out there on revenue for large organizations who might otherwise use this.

In my case, I’m trying to “sell” it to my board to adopt discourse. I’m sure they won’t like this missing capibility

6 Likes

Who decided the username had to be a 5 digit number? That’s a bad decision.

3 Likes

It’s quite common from what I have seen in larger organisations to have their AD logon use their payroll or ID number in order to logon rather than names. Not necessarily 5 numbers however. For example my last organisation my login was B3293016 - would be difficult to distinguish who that is if they then used SSO to check against that login and use it for discourse username and mentions.

8 Likes

What @mikechristopher said. The 5 did fit # is our employee I’d. Technically it’s 6, but the zero at the beginning is left off as we haven’t reached numbers greater than 100,000.

Bottom line, again having the feature I described will give corporate/enterprise clients a lot better usability.

Had you not integrated SSO, I’d understand being reluctant to allow full name tags vs username. But you made SSO available, this is a logical next step enhancement

5 Likes

I am not against adding this kind of option, but at the moment none of our paying customers need it so I cannot prioritize it.

I would probably recommend building this as a plugin first, this is something I would consider building if an enterprise customer funded it.

7 Likes

@mcwumbly have you had any luck with the CSS route?

Haven’t tried it, sorry. Just threw out the idea, but this isn’t something I’ve felt the need to explore too deeply personally.

2 Likes

Just to beat this dead horse a bit more, one of the barriers we’re having in our group is that people get super easily confused by the usernames. So right now, they have no problems making mentions, but when reading, they often don’t know who the mentioned person is. As such, in our use case, @cpradio (Jim Smith) would be ideal. The user would type in the @mention (let’s say @cpradio) and it automatically turns into @cpradio (Jim Smith) for others to read.

This would be just like the username mentions by each of our posts.

2 Likes

Has there been any movement here? It’s annoying to have to click on a username to figure out who the actual person is. And trying to move from Facebook Groups to Discourse is a pain when don’t get to see full names by default. I don’t think uniqueness is really the problem that people think it is from reading previous comments, as, once again, you can use usercards to differentiate if that’s the case. I’ve already changed the site settings to prioritize full names in UX…

3 Likes

I made a quick script that does this. I put it in a component, in the </head> section, and it works. It could definitely be improved upon, but here it is.

<script type="text/discourse-plugin" version="0.1">
    var decorateAtMentions = function($post) {
        $post.find("a.mention").each(function() {
            var $elem = $(this);
            var username = $elem.text().substr(1);
            
            var data = Discourse.User.findByUsername(username).then(function(user) {
                var avatarurl = user.avatar_template.replace("{size}", 18);
                var realname = user.name;
                $elem.before("<img src='"+avatarurl+"' title='"+realname+"'>");
                $elem.attr("title", realname);
                $elem.after("["+realname+"]");
            });
        })
    }
    api.decorateCooked(decorateAtMentions, {id: 'decorate-at-mentions'});
</script>

The title in the img tag is a potential problem if a name has a single quote character, so it needs to be done “the right way” (myself, I’ll probably remove it since I don’t really like it that much).

I wanted to change the link text, instead of appending the real name at the end, but unfortunately that breaks the click handler for the user card (since it apparently relies on the mention text to load the name) and I didn’t want to go down that rabbit hole.

5 Likes