Project

General

Profile

Feature #39529 » feature-39529-v3.patch

Go MAEDA, 2024-08-22 10:40

View differences:

app/helpers/application_helper.rb
1307 1307
            name = remove_double_quotes(identifier)
1308 1308
            u = User.visible.find_by("LOWER(login) = :s AND type = 'User'", :s => name.downcase)
1309 1309
            link = link_to_user(u, :only_path => only_path, :class => 'user-mention', :mention => true) if u
1310
            if u && obj && !obj.visible?(u)
1311
              link += content_tag(
1312
                'span', l(:notice_invalid_mention),
1313
                class: 'icon-only icon-warning',
1314
                title: l(:notice_invalid_mention)
1315
              )
1316
            end
1310 1317
          end
1311 1318
        end
1312 1319
        (leading + (link || "#{project_prefix}#{prefix}#{repo_prefix}#{sep}#{identifier}#{comment_suffix}"))
config/locales/en.yml
195 195
  notice_issue_not_closable_by_blocking_issue: "This issue cannot be closed because it is blocked by at least one open issue."
196 196
  notice_issue_not_reopenable_by_closed_parent_issue: "This issue cannot be reopened because its parent issue is closed."
197 197
  notice_invalid_watcher: "Invalid watcher: User will not receive any notifications because they do not have access to view this object."
198
  notice_invalid_mention: "Invalid mention: User will not receive mention notifications because it does not have access to view this object."
198 199

  
199 200
  error_can_t_load_default_data: "Default configuration could not be loaded: %{value}"
200 201
  error_scm_not_found: "The entry or revision was not found in the repository."
test/helpers/application_helper_test.rb
612 612
    end
613 613
  end
614 614

  
615
  def test_mention_link_to_users_who_are_not_authorised_to_view_the_object
616
    set_language_if_valid 'en'
617
    with_settings :text_formatting => 'textile' do
618
      issue = Issue.find(4)
619
      assert_not issue.visible?(User.find(3))
620

  
621
      expected_output =
622
        link_to_user(User.find(3), only_path: true, class: 'user-mention', mention: true) +
623
        content_tag('span', l(:notice_invalid_mention),
624
                    class: 'icon-only icon-warning', title: l(:notice_invalid_mention))
625
      assert_equal "<p>#{expected_output}</p>", textilizable("@#{User.find(3).login}", :object => issue)
626

  
627
      journal = Journal.find(2)
628
      assert_equal '<p><a href="#note-2">#note-2</a></p>', textilizable('#note-2', :object => journal)
629
    end
630
  end
631

  
615 632
  def test_link_to_note_within_the_same_page
616 633
    with_settings :text_formatting => 'textile' do
617 634
      issue = Issue.find(1)
(7-7/7)