Feature #36699 » 0001-Render-mentioned-users-with-leading-36699-13919.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
| 60 | 60 |
case principal |
| 61 | 61 |
when User |
| 62 | 62 |
name = h(principal.name(options[:format])) |
| 63 |
name = "@" + name if options[:mention] |
|
| 63 | 64 |
css_classes = '' |
| 64 | 65 |
if principal.active? || (User.current.admin? && principal.logged?) |
| 65 | 66 |
url = user_url(principal, :only_path => only_path) |
| ... | ... | |
| 1265 | 1266 |
elsif sep == "@" |
| 1266 | 1267 |
name = remove_double_quotes(identifier) |
| 1267 | 1268 |
u = User.visible.find_by("LOWER(login) = :s AND type = 'User'", :s => name.downcase)
|
| 1268 |
link = link_to_user(u, :only_path => only_path, :class => 'user-mention') if u |
|
| 1269 |
link = link_to_user(u, :only_path => only_path, :class => 'user-mention', :mention => true) if u
|
|
| 1269 | 1270 |
end |
| 1270 | 1271 |
end |
| 1271 | 1272 |
(leading + (link || "#{project_prefix}#{prefix}#{repo_prefix}#{sep}#{identifier}#{comment_suffix}"))
|
| public/stylesheets/application.css | ||
|---|---|---|
| 150 | 150 |
a.issue.closed, a.issue.closed:link, a.issue.closed:visited { color: #999; text-decoration: line-through; }
|
| 151 | 151 |
a.project.closed, a.project.closed:link, a.project.closed:visited { color: #999; }
|
| 152 | 152 |
a.user.locked, a.user.locked:link, a.user.locked:visited {color: #999;}
|
| 153 |
a.user.user-mention {
|
|
| 154 |
background-color: #DDEEFF; |
|
| 155 |
padding: 0.1em 0.1em; |
|
| 156 |
border-radius: 0.1em; |
|
| 157 |
} |
|
| 153 | 158 | |
| 154 | 159 |
#sidebar a.selected {line-height:1.7em; padding:1px 3px 2px 2px; margin-left:-2px; background-color:#9DB9D5; color:#fff; border-radius:2px;}
|
| 155 | 160 |
#sidebar a.selected:hover {text-decoration:none;}
|
| test/helpers/application_helper_test.rb | ||
|---|---|---|
| 562 | 562 |
'user:jsmith' => link_to_user(User.find_by_id(2)), |
| 563 | 563 |
'user:JSMITH' => link_to_user(User.find_by_id(2)), |
| 564 | 564 |
'user#2' => link_to_user(User.find_by_id(2)), |
| 565 |
'@jsmith' => link_to_user(User.find_by_id(2), class: 'user-mention'), |
|
| 566 |
'@jsmith.' => "#{link_to_user(User.find_by_id(2), class: 'user-mention')}.",
|
|
| 567 |
'@JSMITH' => link_to_user(User.find_by_id(2), class: 'user-mention'), |
|
| 568 |
'@abcd@example.com' => link_to_user(User.find_by_id(u_email_id), class: 'user-mention'), |
|
| 565 |
'@jsmith' => link_to_user(User.find_by_id(2), class: 'user-mention', mention: true),
|
|
| 566 |
'@jsmith.' => "#{link_to_user(User.find_by_id(2), class: 'user-mention', mention: true)}.",
|
|
| 567 |
'@JSMITH' => link_to_user(User.find_by_id(2), class: 'user-mention', mention: true),
|
|
| 568 |
'@abcd@example.com' => link_to_user(User.find_by_id(u_email_id), class: 'user-mention', mention: true),
|
|
| 569 | 569 |
'user:abcd@example.com' => link_to_user(User.find_by_id(u_email_id)), |
| 570 |
'@foo.bar@example.com' => link_to_user(User.find_by_id(u_email_id_2), class: 'user-mention'), |
|
| 570 |
'@foo.bar@example.com' => link_to_user(User.find_by_id(u_email_id_2), class: 'user-mention', mention: true),
|
|
| 571 | 571 |
'user:foo.bar@example.com' => link_to_user(User.find_by_id(u_email_id_2)), |
| 572 | 572 |
# invalid user |
| 573 | 573 |
'user:foobar' => 'user:foobar', |
| ... | ... | |
| 596 | 596 |
# user link format: @jsmith@somenet.foo |
| 597 | 597 |
raw = "@jsmith@somenet.foo should not be parsed in jsmith@somenet.foo" |
| 598 | 598 |
assert_match( |
| 599 |
%r{<p><a class="user active user-mention".*>#{u.name}</a> should not be parsed in #{html}</p>},
|
|
| 599 |
%r{<p><a class="user active user-mention".*>@#{u.name}</a> should not be parsed in #{html}</p>},
|
|
| 600 | 600 |
textilizable(raw, :project => Project.find(1)) |
| 601 | 601 |
) |
| 602 | 602 |
# user link format: user:jsmith@somenet.foo |
| ... | ... | |
| 616 | 616 |
# user link format: @jsmith@somenet.foo |
| 617 | 617 |
raw = "@jsmith@somenet.foo should not be parsed in jsmith@somenet.foo" |
| 618 | 618 |
assert_match( |
| 619 |
%r{<p><a class=\"user active user-mention\".*>#{u.name}</a> should not be parsed in #{html}</p>},
|
|
| 619 |
%r{<p><a class=\"user active user-mention\".*>@#{u.name}</a> should not be parsed in #{html}</p>},
|
|
| 620 | 620 |
textilizable(raw, :project => Project.find(1)) |
| 621 | 621 |
) |
| 622 | 622 |
# user link format: user:jsmith@somenet.foo |
| test/unit/mailer_test.rb | ||
|---|---|---|
| 195 | 195 |
issue = Issue.generate!(:description => '@jsmith') |
| 196 | 196 |
assert Mailer.deliver_issue_add(issue) |
| 197 | 197 |
assert_select_email do |
| 198 |
assert_select "a[href=?]", "http://localhost:3000/users/2", :text => 'John Smith' |
|
| 198 |
assert_select "a[href=?]", "http://localhost:3000/users/2", :text => '@John Smith'
|
|
| 199 | 199 |
end |
| 200 | 200 |
end |
| 201 | 201 | |
- « Previous
- 1
- 2
- Next »