Making WordPress.org

Opened 9 years ago

Closed 8 years ago

#830 closed enhancement (fixed)

Add mentions to Trac

Reported by: pento's profile pento Owned by: ocean90's profile ocean90
Milestone: Priority: normal
Component: Trac Keywords:
Cc:

Description

@nacin is working on this.

Attachments (1)

830.patch (28.6 KB) - added by ocean90 8 years ago.

Download all attachments as: .zip

Change History (32)

#1 @pento
9 years ago

@nacin forgets to deploy things before testing.

#2 @nacin
9 years ago

@pento: It's now deployed.

#3 follow-up: @nacin
9 years ago

It works, but I've turned it off for the moment. Important stuff left to do:

  • Avoid notifying mentions that are inside quoted content (replies)
  • Apply it only to individuals who have posted to a Trac before (otherwise, at-since will be getting emails)

Also, available for core trac only:

  • Subscribe you to all further emails for the thread
  • Avoid sending you a mentions email if you've already specifically blocked the thread

Nice-to-haves, which are things that should be done entirely in JS (I will not be doing them):

  • Link @{username} in Trac tickets/comments to profiles
  • Highlight your own @{username} in Trac tickets/comments
  • Autocomplete for those who have commented to the ticket already, as well as ever before on Trac (see above)

I'm unsure about:

  • Usernames with spaces, capital letters, @-signs, etc. (I think we may just start renaming user logins to match their nicenames as needed)

#4 @nacin
9 years ago

In 1182:

Trac mentions: Restrict notifications to individuals who have posted to a Trac before. see #830.

#5 @nacin
9 years ago

@pento, can you check to see if this works?

#6 @pento
9 years ago

@nacin Confirmed.

#7 in reply to: ↑ 3 @nacin
9 years ago

Replying to nacin:

It works, but I've turned it off for the moment. Important stuff left to do:

  • Avoid notifying mentions that are inside quoted content (replies)
  • Apply it only to individuals who have posted to a Trac before (otherwise, at-since will be getting emails)

Also, available for core trac only:

  • Subscribe you to all further emails for the thread
  • Avoid sending you a mentions email if you've already specifically blocked the thread

All of this is done.

Mentions are on and working for the following Tracs: Core, Meta, bbPress, BuddyPress, GlotPress. So, all of the ones that actually get used.

I'm unsure about:

  • Usernames with spaces, capital letters, @-signs, etc. (I think we may just start renaming user logins to match their nicenames as needed)

Based on my reading of the .org mentions code, usernames with capital letters are OK. There have been 14 users with an '@' who have been active on Trac in the past 18 months, and another few dozen who have spaces in their names. Those users will have some problems, and already do elsewhere on .org.

Last edited 9 years ago by nacin (previous) (diff)

#8 @nacin
9 years ago

Oh, and it's on for themes and plugins tracs too.

#9 @helen
9 years ago

  • Cc helen.y.hou@… added

What do we think of adding @ mention suggestions for the reporter and any other commenters on the ticket? Possibly also include any other committers in the result set but only shown when you've got more than "@" typed. GitHub does it kind of like this.

#10 @helen
9 years ago

I did this for a 10up internal thing recently using At.js, which I believe O2 and BuddyPress also use now, it's fairly quick and painless to implement if we do something like output a JS object with the relevant usernames.

Last edited 9 years ago by helen (previous) (diff)

This ticket was mentioned in Slack in #meta by helen. View the logs.


9 years ago

#12 @helen
9 years ago

Okay, for fun, run this in the console or as a user script on a ticket and then try an @ mention in the comment box:

(function($){
  var atCss = document.createElement('link'),
      moreCss = document.createElement('style');
  document.getElementsByTagName('head')[0].appendChild(atCss);
  document.getElementsByTagName('head')[0].appendChild(moreCss)
  atCss.rel = 'stylesheet';
  atCss.type = 'text/css';
  atCss.href = '//ichord.github.io/At.js/dist/css/jquery.atwho.css';
  moreCss.innerHTML = '#atwho-container { font-size: 1.3em }';

  $.getScript('//ichord.github.io/Caret.js/src/jquery.caret.js', function() {
    $.getScript('//ichord.github.io/At.js/dist/js/jquery.atwho.js', function() {
      var users = [];
      // Most recent should show up first
      $($('.change .username').get().reverse()).each(function () {
        var username = $(this).data('username');
        // @todo: exclude bots and include other committers
        if (typeof username !== 'undefined' && -1 === $.inArray(username, users)) {
          users.push($(this).data('username'));
        }
      });

      $('#comment').atwho({
        at: "@",
        data: users
      });
    });
  });
})(jQuery);
Version 1, edited 9 years ago by helen (previous) (next) (diff)

#13 @pento
9 years ago

:thumbsup:

I'm surprised we don't have caret/atwho anywhere on W.org. We can dump them somewhere easily enough, though.

#14 @helen
9 years ago

I've been using this as a user script for the last few weeks and it's awesome - what can I do to help patch this in? There is a @todo in the example above but it can be done later or we can add some more variables and/or data attributes.

#15 @Otto42
9 years ago

@helen That userscript causes me to get a 404 on https://ichord.github.io/Caret.js/src/jquery.caret.map .

It does appear to work regardless, albeit with a pretty awful font. Is there a version of this script somewhere that isn't missing files?

#16 @helen
9 years ago

@Otto42 Yeah, can use //ichord.github.io/Caret.js/dist/jquery.caret.min.js it looks like (and the min version for atwho.js as well). I don't know why they have that there if there's no source map actually available. What's awful with the font - that it seems to have gone tiny again or is it ugly on Windows or something? I thought I fixed the tiny thing but maybe not. Edit: Oh, I see what I did - it's a class of .atwho-container, not an ID like I have in my script.

Last edited 9 years ago by helen (previous) (diff)

#18 @ocean90
8 years ago

  • Owner set to ocean90
  • Status changed from new to accepted

Have a patch ready to implement suggestions.

Last edited 8 years ago by ocean90 (previous) (diff)

@ocean90
8 years ago

#19 @ocean90
8 years ago

In 1956:

Trac: Add At.js and Caret.js, an autocompletion library.

See #830.

#20 @ocean90
8 years ago

In 1957:

Trac: Add autocomplete for usernames and attachments.

For now the list of usernames includes users who have commented to the ticket. Core Trac includes also committers.

Props helen, johnbillion, DrewAPicture, ocean90.
See #830.

#21 @ocean90
8 years ago

In 1958:

Trac: Bump scripts version for cache bust.

See #830.

#23 @ocean90
8 years ago

In 1961:

Trac: Bump scripts version for cache bust.

See #830.

#25 @ocean90
8 years ago

In 1967:

Trac: Link @-mentions to the w.org profile.

See #830.

#26 @ocean90
8 years ago

In 1971:

Trac: Update mentionsRegEx to support usernames with up to 20 chars.

See #830.

#27 @ocean90
8 years ago

In 1990:

Trac: Enhance autocomplete for usernames by separating ticket and non-ticket participants.

props helen, ocean90.
See #830.

#28 @ocean90
8 years ago

In 1991:

Trac: Improve highlighting of your own @-mention.

See #830.

#29 @ocean90
8 years ago

In 1993:

Trac: Don't link reserved names.

Props DrewAPicture.
Fixes #1344.
See #830.

#30 @Otto42
8 years ago

We now use @ mentions for user nicenames pretty much everywhere. Is there anything left to fix here?

#31 @ocean90
8 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.