Feature #30829 » 30829-linkto-current-issue-note.patch
app/helpers/application_helper.rb | ||
---|---|---|
897 | 897 |
repo_identifier = $~[:repo_identifier] |
898 | 898 |
sep = $~[:sep1] || $~[:sep2] || $~[:sep3] || $~[:sep4] |
899 | 899 |
identifier = $~[:identifier1] || $~[:identifier2] || $~[:identifier3] |
900 |
comment_suffix = $~[:comment_suffix] |
|
901 |
comment_id = $~[:comment_id] |
|
900 |
comment_suffix = $~[:comment_suffix1] || $~[:comment_suffix2]
|
|
901 |
comment_id = $~[:comment_id1] || $~[:comment_id2]
|
|
902 | 902 | |
903 | 903 |
if tag_content |
904 | 904 |
$& |
... | ... | |
934 | 934 |
oid = identifier.to_i |
935 | 935 |
case prefix |
936 | 936 |
when nil |
937 |
if oid.to_s == identifier && |
|
937 |
issue = nil |
|
938 |
if oid.to_s == identifier |
|
938 | 939 |
issue = Issue.visible.find_by_id(oid) |
940 |
elsif identifier.blank? |
|
941 |
oid = nil |
|
942 |
issue = |
|
943 |
case obj |
|
944 |
when Issue |
|
945 |
obj |
|
946 |
when Journal |
|
947 |
obj.issue |
|
948 |
else |
|
949 |
nil |
|
950 |
end |
|
951 |
end |
|
952 |
if issue |
|
939 | 953 |
anchor = comment_id ? "note-#{comment_id}" : nil |
940 | 954 |
url = issue_url(issue, :only_path => only_path, :anchor => anchor) |
941 | 955 |
link = if sep == '##' |
... | ... | |
1066 | 1080 |
) |
1067 | 1081 |
) |
1068 | 1082 |
( |
1069 |
(?<identifier1>\d+) |
|
1070 |
(?<comment_suffix> |
|
1071 |
(\#note)? |
|
1072 |
-(?<comment_id>\d+) |
|
1073 |
)? |
|
1083 |
( |
|
1084 |
(?<identifier1>\d+) |
|
1085 |
(?<comment_suffix1> |
|
1086 |
(\#note)? |
|
1087 |
-(?<comment_id1>\d+) |
|
1088 |
)? |
|
1089 |
)| |
|
1090 |
( |
|
1091 |
(?<comment_suffix2> |
|
1092 |
note\-(?<comment_id2>\d+) |
|
1093 |
) |
|
1094 |
) |
|
1074 | 1095 |
)| |
1075 | 1096 |
( |
1076 | 1097 |
(?<sep3>:) |
test/helpers/application_helper_test.rb | ||
---|---|---|
28 | 28 |
:members, :member_roles, :roles, |
29 | 29 |
:repositories, :changesets, |
30 | 30 |
:projects_trackers, |
31 |
:trackers, :issue_statuses, :issues, :versions, :documents, |
|
31 |
:trackers, :issue_statuses, :issues, :versions, :documents, :journals,
|
|
32 | 32 |
:wikis, :wiki_pages, :wiki_contents, |
33 | 33 |
:boards, :messages, :news, |
34 | 34 |
:attachments, :enumerations, |
... | ... | |
423 | 423 |
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text), "#{text} failed" } |
424 | 424 |
end |
425 | 425 | |
426 |
def test_issue_links_with_note_id_only |
|
427 |
issue = Issue.find(1) |
|
428 |
css_classes = issue.css_classes |
|
429 |
@project = issue.project |
|
430 | ||
431 |
to_test = { |
|
432 |
'#note-14' => |
|
433 |
link_to('#note-14', {:controller => 'issues', :action => 'show', :id => 1, :anchor => 'note-14'}, |
|
434 |
:class => css_classes, :title => 'Bug: Cannot print recipes (New)' |
|
435 |
), |
|
436 |
} |
|
437 |
to_test.each do |text, result| |
|
438 |
assert_equal "<p>#{result}</p>", textilizable(text, :object => issue), "#{text} failed" |
|
439 |
end |
|
440 | ||
441 |
journal = Journal.find(2) # #1#note-2 |
|
442 |
to_test = { |
|
443 |
'#note-2' => |
|
444 |
link_to('#note-2', {:controller => 'issues', :action => 'show', :id => 1, :anchor => 'note-2'}, |
|
445 |
:class => css_classes, :title => 'Bug: Cannot print recipes (New)' |
|
446 |
), |
|
447 |
} |
|
448 |
to_test.each do |text, result| |
|
449 |
assert_equal "<p>#{result}</p>", textilizable(text, :object => journal), "#{text} failed" |
|
450 |
end |
|
451 |
end |
|
452 | ||
426 | 453 |
def test_user_links_with_email_as_login_name_should_not_be_parsed_textile |
427 | 454 |
with_settings :text_formatting => 'textile' do |
428 | 455 |
u = User.generate!(:login => 'jsmith@somenet.foo') |