Feature #36699
closedChange the text of the user link when converting @user notation to html
0%
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.
I propose to change this to the following:
- Plan 1. john wilson Smith
- Plan 2. @jsmith(John Smith)
- Plan 3. @jsmith
- The functions are different from those of other
user#1
anduser: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
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
Updated by Marius BĂLTEANU over 2 years ago
- File mention.png mention.png added
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 @:
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.
Updated by Marius BĂLTEANU over 2 years ago
- File 0001-Render-mentioned-users-with-leading-36699-13919.patch 0001-Render-mentioned-users-with-leading-36699-13919.patch added
- Target version set to 5.0.0
I think it's better to actually render the display name with @. Patch attached.
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!