Defect #36909

Mentions not working if status is changed

Added by B P 6 months ago. Updated 5 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Marius BALTEANU% Done:

0%

Category:Email notifications
Target version:5.0.1
Resolution:Fixed Affected version:5.0.0

Description

In Redmine 5.0 the new Mentions feature is not working, if the status of the ticket is changed.
It seems there is an error caused by reassigning a variable:

Error

//<![CDATA[
const currentDataSources = rm.AutoComplete.dataSources;const newDataSources = JSON.parse('{"users":"/watchers/autocomplete_for_mention?object_id=XXXXX\u00XXobject_type=issue\u00XXproject_id=helpdesk\u00XXq="}'); rm.AutoComplete.dataSources = Object.assign(currentDataSources, newDataSources);
//

Steps to reproduce:
- Edit Ticket
- @Mentions works
- Change Status to other state
- @Mentions not working and the obove error is shown in dev tools

image.png - Error (30.6 KB) B P, 2022-04-08 13:10


Related issues

Related to Redmine - Feature #13919: Mention user on issues and wiki pages using @user with au... Closed
Copied to Redmine - Defect #37053: Attachments are lost when the status of the ticket is cha... Closed

Associated revisions

Revision 21569
Added by Marius BALTEANU 5 months ago

Fix that mentions not working after issue status is changed (#36909).

Revision 21571
Added by Marius BALTEANU 5 months ago

Merged r21569 to 5.0-stable (#36909).

History

#1 Updated by Marius BALTEANU 6 months ago

  • Status changed from New to Confirmed
  • Assignee set to Marius BALTEANU
  • Target version set to 5.0.1

#2 Updated by Fernando Hartmann 5 months ago

The same happens with attachments.
Steps
  1. Edit ticket
  2. Select a file to attach
    The file appears at Files section
  3. Change issue status to other state

Right after the status change, the file listed at Files section, is removed, and the error above is printed on browser console.

#3 Updated by Fernando Hartmann 5 months ago

Is there a patch ready for this ?

#4 Updated by Marius BALTEANU 5 months ago

Thanks for reporting this!

Can you test the following patch?

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 1dfa26cb2..031273d44 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1831,9 +1831,7 @@ module ApplicationHelper

   def update_data_sources_for_auto_complete(data_sources)
     javascript_tag(
-      "const currentDataSources = rm.AutoComplete.dataSources;" \
-      "const newDataSources = JSON.parse('#{data_sources.to_json}'); " \
-      "rm.AutoComplete.dataSources = Object.assign(currentDataSources, newDataSources);" 
+      "rm.AutoComplete.dataSources = Object.assign(rm.AutoComplete.dataSources, JSON.parse('#{data_sources.to_json}'));" 
     )
   end

This patch fixes only the console error.

#5 Updated by Marius BALTEANU 5 months ago

Fernando Hartmann wrote:

The same happens with attachments.
Steps
  1. Edit ticket
  2. Select a file to attach
    The file appears at Files section
  3. Change issue status to other state

Right after the status change, the file listed at Files section, is removed, and the error above is printed on browser console.

This is a different error and it's generated by the change from #34641. Until a proper fix is ready, you can try reverting the changes from app/views/issues/edit.js.erb and app/views/issues/edit.js.erb.

#6 Updated by Marius BALTEANU 5 months ago

  • Copied to Defect #37053: Attachments are lost when the status of the ticket is changed added

#7 Updated by Marius BALTEANU 5 months ago

Created a new issue (#37053) for the second issue.

#8 Updated by Cyrill A 5 months ago

Marius BALTEANU wrote:

Thanks for reporting this!

Can you test the following patch?
[...]

This patch fixes only the console error.

worked for me with same issue. thank you

#9 Updated by Marius BALTEANU 5 months ago

  • Related to Feature #13919: Mention user on issues and wiki pages using @user with autocomplete added

#10 Updated by Marius BALTEANU 5 months ago

  • Status changed from Confirmed to Resolved
  • Resolution set to Fixed

Fixed committed with a test.

#11 Updated by Marius BALTEANU 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF