Project

General

Profile

Feature #39529 » feature-39529-v2.patch

Mizuki ISHIKAWA, 2024-01-04 07:59

View differences:

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

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

  
583
  def test_mention_link_to_users_who_are_not_authorised_to_view_the_object
584
    set_language_if_valid 'en'
585
    with_settings :text_formatting => 'textile' do
586
      issue = Issue.find(4)
587
      assert_not issue.visible?(User.find(3))
588
      assert_equal "<p>#{link_to_user(User.find(3), only_path: true, class: 'user-mention', mention: true)}#{content_tag('span', l(:notice_mention_watcher), class: 'icon-only icon-warning', title: l(:notice_invalid_mention))}</p>", textilizable("@#{User.find(3).login}", :object => issue)
589

  
590
      journal = Journal.find(2)
591
      assert_equal '<p><a href="#note-2">#note-2</a></p>', textilizable('#note-2', :object => journal)
592
    end
593
  end
594

  
583 595
  def test_link_to_note_within_the_same_page
584 596
    with_settings :text_formatting => 'textile' do
585 597
      issue = Issue.find(1)
(4-4/7)