]> source.dussan.org Git - redmine.git/commitdiff
Merged r22427 and r22428 to 5.0-stable (#39521).
authorMarius Balteanu <marius.balteanu@zitec.com>
Mon, 13 Nov 2023 17:35:51 +0000 (17:35 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Mon, 13 Nov 2023 17:35:51 +0000 (17:35 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22434 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/issues/_edit.html.erb
test/system/inline_autocomplete_test.rb

index d816ff6fc5fc9252eaf2c70e6e3e9fe78516f0f0..219122d257e724b85522c812002a7ba777086fd8 100644 (file)
       <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %>
       </fieldset>
     <% end %>
+    <% if !@issue.attributes_editable? && User.current.allowed_to?(:add_issue_watchers, @issue.project) %>
+      <%= update_data_sources_for_auto_complete({users: watchers_autocomplete_for_mention_path(project_id: @issue.project, q: '', object_type: 'issue',
+                                                                                               object_id: @issue.id)}) %>
+    <% end %>
     <% if @issue.attachments_addable? %>
       <fieldset id="add_attachments"><legend><%= l(:label_attachment_plural) %></legend>
         <% if @issue.attachments.any? && @issue.safe_attribute?('deleted_attachment_ids') %>
index e8d65fb152ee5a24eee920b70fcd094b4a0b2b6b..8c1996054ebbfda644ccf23b764023719601aaed 100644 (file)
@@ -218,4 +218,23 @@ class InlineAutocompleteSystemTest < ApplicationSystemTestCase
 
     assert_equal '@dlopper ', find('#notes').value
   end
+
+  def test_inline_autocomplete_for_users_on_issues_without_edit_issue_permission
+    role_developer = Role.find(2)
+    role_developer.remove_permission!(:edit_issues)
+    role_developer.add_permission!(:add_issue_watchers)
+
+    log_user('jsmith', 'jsmith')
+    visit '/issues/4/edit'
+
+    find('#issue_notes').click
+    fill_in 'issue[notes]', :with => '@'
+
+    within('.tribute-container') do
+      assert page.has_text? 'John Smith'
+      first('li').click
+    end
+
+    assert_equal '@jsmith ', find('#issue_notes').value
+  end
 end