プロジェクト

全般

プロフィール

Vote #81836

完了

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

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Text formatting_26
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
26
version_id:
0
issue_org_id:
36699
author_id:
259873
assigned_to_id:
107353
comments:
6
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

#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 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.


journals

--------------------------------------------------------------------------------
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:

<pre><code class="diff">
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: "@";
+}
</code></pre>

2. Rendered with @

<pre><code class="diff">
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
</code></pre>

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

!{width: 50%; border: 1px solid grey;}mention.png!

--------------------------------------------------------------------------------
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 @:
>
> !{width: 50%; border: 1px solid grey;}mention.png!

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.
--------------------------------------------------------------------------------
I think it's better to actually render the display name with @. Patch attached.
--------------------------------------------------------------------------------
Change committed, thanks!
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,13919,Mention user on issues and wiki pages using @user with autocomplete

Admin Redmine さんが約2年前に更新

  • カテゴリText formatting_26 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0