Making WordPress.org

Opened 8 years ago

Closed 6 years ago

Last modified 4 years ago

#2488 closed enhancement (fixed)

Add Twitter/Github style username autocomplete/linking to support forums.

Reported by: danieliser's profile danieliser Owned by:
Milestone: Q1 Priority: normal
Component: Support Forums Keywords:
Cc:

Description

The aim here is so that you can quickly tag another user just by typing @username in the TinyMCE editor.

As you type characters after the @ symbol it will begin suggesting usernames. Hitting enter, space or selecting one of the suggestions will autocomplete the username as well as wrapping it with a link to the users profiles.wordpress.org page.

Though this is currently limited in scope to @usernames, it can easily be used to handle other automated content linking such as trac tickets via hash (#) or similar.

I have code for this already that I will be porting to work for bbPress 2.

The code currently can support templates for the returned result to pull from the theme but is written to send back json and render simple link via JavaScript.

Considerations to be made:

  • Minimum number of characters before api requests are made.
  • Number of results
  • Caching mechanisms for results
  • Should there any limitations on who can use this beyond being logged in?

Attachments (1)

Screen Shot 2019-01-10 at 10.57.49 am.png (17.4 KB) - added by dd32 6 years ago.

Download all attachments as: .zip

Change History (30)

#2 @Otto42
8 years ago

Does it scale? There are 10+ million user accounts, all of them through the forums. There has to be a load issue somewhere.

#3 @danieliser
8 years ago

@Otto42 If we preload a set of suggestions based on all users who have already left a reply on the current topic that would solve the issue for most users without any extra hits to the server, pure JS at that point.

I'm not sure what type of caching is set up for the forums currently but the queries could be stored in cache.

I have even considered doing something along the lines of as they type and the second query fires off since its a narrowing of the results in the previous set, if they were cached we could strip off the last letter of the search query string repeatedly until to a cached match is found, then loop those results looking for further matches.

That would make it a 0 query hit potentially after caches build up.

Version 0, edited 8 years ago by danieliser (next)

#4 @SergeyBiryukov
8 years ago

A similar autocomplete feature was implemented in #830 for Trac, makes sense to do the same on the forums.

Pre-populating the list of usernames with users who have replied on the topic should resolve scalability concerns.

#5 follow-up: @danieliser
8 years ago

@SergeyBiryukov - Awesome, I have this partially working locally. Just haven't had time these past few weeks to polish it off and get a patch uploaded.

#6 in reply to: ↑ 5 @positivejam
7 years ago

Replying to danieliser:

@SergeyBiryukov - Awesome, I have this partially working locally. Just haven't had time these past few weeks to polish it off and get a patch uploaded.

@danieliser could you share the status of this feature with regards to bbPress? It is functionality that I've been investigating and thought I might implement myself as a separate plugin, but if it's coming soon to bbPress itself, obviously I would hold off. Do you know when it might ship/you might have a patch available for others to use?

My interest is solely in having it in bbPress; sorry in advance if that is considered off-topic here.

This ticket was mentioned in Slack in #forums by jcastaneda. View the logs.


7 years ago

This ticket was mentioned in Slack in #forums by clorith. View the logs.


7 years ago

#9 @Clorith
7 years ago

The simple approach, that also addresses the scaling concerns, is to make this a purely JS driven feature.

You rarely, if ever, need to at-mention users outside a topic, so making this build up the names list after the DOM is loaded and you know the available usernames (or just having the names pre-loaded in a JS variable) and limiting it purely to those entries inside that topic would contain things and not be a concern with regard to the system in general.

#10 @dd32
7 years ago

You rarely, if ever, need to at-mention users outside a topic

This is what we do on WordPress core trac - We pre-load anyone with a role (ie. committers, etc) but all other at-mentions are based on those participating in the current ticket.

#11 @danieliser
7 years ago

Perfect solution @dd32. Likely means the code is already tested and reliable as well meaning it can be implemented 10x faster ;)

#12 @jgflores
6 years ago

Hi @danieliser

Do you have news about the autocomplete feature for bbpress forums?

Thanks in advance for your reply!

Regards,
Jose

#13 @tellyworth
6 years ago

  • Milestone set to Q1

#14 follow-up: @dd32
6 years ago

In 8064:

Forums: Add an initial version of @mention autocompletion for the support forums.

See #2488.

#15 in reply to: ↑ 14 @dd32
6 years ago

Replying to dd32:

In 8064:

Forums: Add an initial version of @mention autocompletion for the support forums.

See #2488.

This initial version only supports autocompletion of Thread participants, it doesn't do any Ajax lookups or autocompletion of moderators/plugin reps/theme reps who have not commented.

It's not yet deployed or activated, but works the same as Trac, see the above screenshot for an example of it's use on the Master 5.0 thread.

This ticket was mentioned in Slack in #forums by dd32. View the logs.


6 years ago

#17 follow-up: @sterndata
6 years ago

In my (humble) opinion, this is a bad idea. We have too much @-pinging in forums. The @ is not useful -- if I'm subscribed to a topic, then I get notifications. If not, then being pinged is just spam. It will lead to increased abuse.

#18 in reply to: ↑ 17 @dd32
6 years ago

Replying to sterndata:

In my (humble) opinion, this is a bad idea. We have too much @-pinging in forums. The @ is not useful -- if I'm subscribed to a topic, then I get notifications. If not, then being pinged is just spam. It will lead to increased abuse.

I think that can be defended with the fact that if someone is going to @mention someone they're going to do it regardless. This just simplifies the process for those who use it legitimately.

There's an argument to be made that you should only get 1 subscription notification though (ie. you shouldn't get a ping notification AND a subscribed notification) but that needs it's own ticket.

#19 @dd32
6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

This has been implemented and deployed to all forums, let's see how this goes, if we need to alter it in any way feel free to re-open or create new tickets for the issues.

#20 @danieliser
6 years ago

@dd32 - Ohhhh, just tried it on a forum topic just now. Love it. Perfect for my initial requests needs.

For those interested in the bbPress stuff. I have just added it to my list of things to complete first half this year, message me on twitter if you want info on that (@daniel_iser)

#21 @iamkingsleyf
6 years ago

nice one

#22 follow-up: @gduquerroy
6 years ago

the autosuggestion works when you are in the "text" tab but in the "visual" tab, it doesn't work.
Do you have any ideas?

#23 @sterndata
6 years ago

Previous objection withdrawn. :-)

#24 in reply to: ↑ 22 ; follow-up: @dd32
6 years ago

Replying to gduquerroy:

the autosuggestion works when you are in the "text" tab but in the "visual" tab, it doesn't work.

We don't have Text/Visual selection on the forums, so if you've got one you've probably got a browser extension adding it.
If you let me know what tool that is, I can see if it's easy to add it there too.

#25 in reply to: ↑ 24 ; follow-up: @gduquerroy
6 years ago

Replying to dd32:

Okay, so we're actually using bbpress-enable-tinymce-visual-tab

https://fr.wordpress.org/plugins/bbpress-enable-tinymce-visual-tab/

Thanks !

#26 in reply to: ↑ 25 @dd32
6 years ago

Replying to gduquerroy:

Replying to dd32:
Okay, so we're actually using bbpress-enable-tinymce-visual-tab
https://fr.wordpress.org/plugins/bbpress-enable-tinymce-visual-tab/

Ah :)
Since this was written primarily for the WordPress.org support forums, which doesn't have that functionality I'm not going to be able to test with random plugins on a self-hosted site.

If you'd like to submit a patch to make it work with those plugins in mind, sure, I suspect the change is Line 16 in this file change it so something like $( 'textarea.bbp-the-content.wp-editor-area, textarea.<ClassNameHereforTinyMCE>' ).atwho({

#28 @dd32
4 years ago

  • Milestone changed from Q1 to 2020 Q1

Milestone renamed

#29 @dd32
4 years ago

  • Milestone changed from 2020 Q1 to Q1

Milestone renamed

Note: See TracTickets for help on using tickets.