Project

General

Profile

Actions

Feature #36699

closed

Change the text of the user link when converting @user notation to html

Added by Mizuki ISHIKAWA over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Text formatting
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

#13919 added the Mention feature to Redmine.
There are three types of notations that can be converted to user links: @user, user#1, and user:user. With this change, only @user will have the Mention feature.

Currently, when you convert @jsmith to HTML, you get the link "John Smith".
I propose to change this to the following:
  • Plan 1. john wilson Smith
  • Plan 2. @jsmith(John Smith)
  • Plan 3. @jsmith
Reason for change:
  • The functions are different from those of other user#1 and user:user notations and should be separated.
  • I think it's important to have @ in front of the name so that people who don't know much about Redmine realize that they can use the Mention feature.

Concerns:
Since @jsmith has always been assumed to be converted to "John Smith", changing it may break the display of wiki pages and issues.

Please let me know what you think.


Files


Related issues

Related to Redmine - Feature #13919: Mention user on issues and wiki pages using @user with autocompleteClosedMarius BĂLTEANU

Actions
Actions #1

Updated by Marius BĂLTEANU over 2 years ago

  • Related to Feature #13919: Mention user on issues and wiki pages using @user with autocomplete added
Actions #2

Updated by Marius BĂLTEANU over 2 years ago

For now I've added the class user-mention to user links generated using @ (r21440).

The easiest way is to obtain "@John Smith" using two different approaches:

1. Only from CSS:

diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index f837a710e..57b3a9680 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -150,6 +150,9 @@ a img{ border: 0; }
 a.issue.closed, a.issue.closed:link, a.issue.closed:visited { color: #999; text-decoration: line-through; }
 a.project.closed, a.project.closed:link, a.project.closed:visited { color: #999; }
 a.user.locked, a.user.locked:link, a.user.locked:visited {color: #999;}
+a.user.user-mention:before {
+  content: "@";
+}

2. Rendered with @

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 33f72e144..c91f7cbaa 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -60,6 +60,7 @@ module ApplicationHelper
     case principal
     when User
       name = h(principal.name(options[:format]))
+      name = "@" + name if options[:is_mention]
       css_classes = ''
       if principal.active? || (User.current.admin? && principal.logged?)
         url = user_url(principal, :only_path => only_path)
@@ -1265,7 +1266,7 @@ module ApplicationHelper
           elsif sep == "@" 
             name = remove_double_quotes(identifier)
             u = User.visible.find_by("LOWER(login) = :s AND type = 'User'", :s => name.downcase)
-            link = link_to_user(u, :only_path => only_path, :class => 'user-mention') if u
+            link = link_to_user(u, :only_path => only_path, :class => 'user-mention', :is_mention => true) if u
           end

Also, maybe we should highlight the users linked with @:

Actions #3

Updated by Mizuki ISHIKAWA over 2 years ago

Marius BALTEANU wrote:

For now I've added the class user-mention to user links generated using @ (r21440).

The easiest way is to obtain "@John Smith" using two different approaches:

1. Only from CSS:

[...]

2. Rendered with @

[...]

Also, maybe we should highlight the users linked with @:

Thank you for your commit.
I think it's a good improvement that doesn't affect the existing look and feel, and people who want to change it can do so using css.

Actions #4

Updated by Marius BĂLTEANU over 2 years ago

I think it's better to actually render the display name with @. Patch attached.

Actions #5

Updated by Marius BĂLTEANU over 2 years ago

  • Assignee set to Marius BĂLTEANU
  • Target version deleted (5.0.0)
  • Resolution set to Fixed

Change committed, thanks!

Actions #6

Updated by Marius BĂLTEANU over 2 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF