Feature #7017

Add watchers from To and Cc fields in issue replies

Added by Lucas Panjer over 6 years ago. Updated 12 months ago.

Status:ClosedStart date:2010-12-02
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:3.3.0
Resolution:Fixed

Description

If this preference is true watchers are added to an issue from the to: and cc: fields of an issue email reply.

email_setting.patch Magnifier (1.89 KB) Lucas Panjer, 2010-12-02 08:19

non-member-issue-view.png (25.2 KB) Toshi MARUYAMA, 2016-03-16 07:07

terminal.png (55.7 KB) Toshi MARUYAMA, 2016-03-16 07:07

admin-issue-view.png (28.9 KB) Toshi MARUYAMA, 2016-03-16 07:07

non-member-role.png (15.5 KB) Toshi MARUYAMA, 2016-03-16 07:07


Related issues

Related to Redmine - Patch #8009: Allow to specify watches for issues created by e-mail Closed 2011-03-29

Associated revisions

Revision 15092
Added by Jean-Philippe Lang over 1 year ago

Add watchers from To and Cc fields in issue replies (#7017).

Revision 15093
Added by Jean-Philippe Lang over 1 year ago

Don't check permission to add watchers if no_permission_check option is set (#7017).

History

#1 Updated by Stanislav German-Evtushenko about 6 years ago

Patches usually aren't accepted without tests.

#2 Updated by Deoren Moor over 3 years ago

+1

This behavior would be very beneficial to our group.

#3 Updated by Deoren Moor over 2 years ago

+1

This would be very helpful.

#4 Updated by Josef Reichardt over 2 years ago

+1

#5 Updated by Jean-Baptiste Barth over 2 years ago

Can anybody explain me this patch like I'm 5 ? What's the current behaviour, and what's the new proposed one ?

It would add "to/cc" persons in an incoming email as watchers of the issue automatically ??

#6 Updated by Josef Reichardt over 2 years ago

I haven't tested the patch (because I hope it will be merged into redmine core), but the current behaviour is: Users are added as watcher from to/cc if you create an issue by email. But if you reply to an email from redmine (to add a comment to the issue) the additional to/cc users from this second email aren't added as watcher.

#7 Updated by Michael Esemplare over 2 years ago

Looking at the mail_handler today, MailHandler.receive_issue calls add_watchers(issue) before saving the issue off so email's entered in the To: and CC: fields will be added as watchers and can reply to the email.

This patch puts add_watchers(issue) in MailHandler.receive_issue_reply (I think) after the issue was saved. Therefore the watchers will be added, but not notified of the issue update. I am skeptical that behavior was intended by the patch. I would call add_watchers before saving the issue.

Would there be any repercussions to:

--- app/models/mail_handler.rb     2014-07-14 21:54:18.578473500 -0700
+++ app/models/mail_handler.rb    2014-09-11 22:44:16.975595000 -0700
@@ -231,6 +231,9 @@
     issue.safe_attributes = issue_attributes_from_keywords(issue)
     issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)}
     journal.notes = cleaned_up_text_body
+
+    # add To and Cc as watchers before saving so the watchers can reply to Redmine
+    add_watchers(issue)
     add_attachments(issue)
     issue.save!
     if logger

Does the add_watcher method in acts_as_watchable automatically handle duplicates?

#8 Updated by Sebastian Paluch over 1 year ago

+100

Please include this tiny patch into official release, it is annoying when people are adding others in CC, email traffic grows but when update is done in Redmine some users are not informed.

#9 Updated by Toshi MARUYAMA over 1 year ago

  • Target version set to 3.3.0

#10 Updated by Go MAEDA over 1 year ago

I don't think we have to add a new setting to enable / disable the feature.

When you create an issue via email, there is no setting to determine if users included in CC are added as watchers. They are always added as watchers in this case. To maintain consistency, when updating an issue the same behavior should apply. The more settings we have the more complex things become.

#11 Updated by Sebastian Paluch over 1 year ago

Go MAEDA wrote:

I don't think we have to add a new setting to enable / disable the feature.

When you create an issue via email, there is no setting to determine if users included in CC are added as watchers. They are always added as watchers in this case. To maintain consistency, when updating an issue the same behavior should apply. The more settings we have the more complex things become.

The thing is that users from CC are not always added as watchers. This works only for new issues but does not works for reply/updates. This patch fixes the issue by adding add_watchers(issue) in mail_handler.rb.

#12 Updated by Deoren Moor over 1 year ago

Go MAEDA wrote:

They are always added as watchers

Sorry if this is a tangent that deserves its own issue, but I thought it might be relevant to the discussion:

For emails that are scraped and placed into a specific project (that most users do not have access to) by the scraping script it appears that the CC field is ignored for new issues/tickets. I've not tested the functionality by temporarily allowing ALL users into the project, so this might be an edge case that most folks don't care about.

Example:

rake -f /opt/redmine/Rakefile redmine:email:receive_imap \
    RAILS_ENV="development" \
    port=993 \
    ssl=1 \
    host=imap.example.com \
    folder=Inbox \
    username=redmine@example.com \
    password=SomethingSecret \
    project=unassigned \
    category=unassigned \
    tracker=support \
    no_permission_check=1 \
    unknown_user=accept \
    move_on_success=processed_emails \
    move_on_failure=rejected_emails \
    allow_override=project,tracker,priority,category,status,resolution

#13 Updated by Jean-Philippe Lang over 1 year ago

  • Tracker changed from Patch to Feature
  • Subject changed from add watchers from to: and cc: fields in email replies to Add watchers from To and Cc fields in issue replies
  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Go MAEDA wrote:

I don't think we have to add a new setting to enable / disable the feature.

Agreed, cange done in r15092 without adding a setting for this.

#14 Updated by Jean-Philippe Lang over 1 year ago

Deoren Moor wrote:

Sorry if this is a tangent that deserves its own issue, but I thought it might be relevant to the discussion:

For emails that are scraped and placed into a specific project by the scraping script (that most users do not have access to) it appears that the CC field is ignored for new issues/tickets. I've not tested the functionality by temporarily allowing ALL users into the project, so this might be an edge case that most folks don't care about.

Watchers were not added if the user is not allowed to add watchers in the target project. I guess this is why watchers are not added in your case. This should be fixed in r15093.

#15 Updated by Toshi MARUYAMA about 1 year ago

  • Status changed from Closed to Reopened

I think mail recipients who do not have "View watchers list" permission can see watches as CC.
For example, non members on redmine.org do not have "View watchers list" permission.

#16 Updated by Jean-Philippe Lang about 1 year ago

  • Assignee changed from Jean-Philippe Lang to Toshi MARUYAMA

Toshi MARUYAMA wrote:

I think mail recipients who do not have "View watchers list" permission can see watches as CC.
For example, non members on redmine.org do not have "View watchers list" permission.

How is it related to this issue? The mail handler was already adding cc as watchers when creating an issue, now it behaves the same when replying to an issue. If I understand correctly, the problem you describe is about notifications, not the mail handler. Those who doesn't want to let users see watchers email addresses in notifications should use Bcc for recipients, which is the default.

#17 Updated by Toshi MARUYAMA about 1 year ago

Non member role

Admin issue view

Non member issue view

Should not show CC to non member

#18 Updated by Jean-Philippe Lang 12 months ago

  • Status changed from Reopened to Closed

Thanks for your feedback. But this issue is not about notifications, it just adds cc of issue replies as watchers, just like when receiving a new issue.

#19 Updated by Toshi MARUYAMA 12 months ago

  • Assignee deleted (Toshi MARUYAMA)

Also available in: Atom PDF