Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

AO3-5130 Rails BOT: Fix co-creator notification for chapter #3023

Merged
merged 2 commits into from Aug 31, 2017

Conversation

Projects
None yet
3 participants
Contributor

redsummernight commented Aug 31, 2017

Issue

https://otwarchive.atlassian.net/browse/AO3-5130

Purpose

The Rails 5.0 upgrade introduced co-creator notification for chapters, however the email template doesn't handle chapters. If the creatable is a chapter, we'll use the parent work in the notification instead.

Testing

See issue. In a local environment I have trouble sending actual emails, so I log them to check the contents:

# deliver! to send it now!
mail = UserMailer.coauthor_notification(pseud.user.id, creation.id, creation.class.name).deliver!
Rails.logger.info mail.body.parts.find { |p| p.content_type.match /html/ }.body.raw_source
AO3-5130 Fix co-creator notification for chapter
The Rails 5.0 upgrade introduced co-creator notification, however
the email template doesn't handle chapters. If the creatable is
a chapter, we'll use the parent work in the notification instead.
@@ -30,12 +30,12 @@ def do_notify
# Notify new co-authors that they've been added to a creation
def notify_co_authors
this_creation = self
- creation = self.work if self.is_a?(Chapter)
+ creation = self.is_a?(Chapter) ? self.work : self
@houndci-bot

houndci-bot Aug 31, 2017

Redundant self detected.

@redsummernight redsummernight changed the title from AO3-5130 Fix co-creator notification for chapter to AO3-5130 Rails BOT: Fix co-creator notification for chapter Aug 31, 2017

sarken approved these changes Aug 31, 2017

This looks good!

Would you have time to add a test for this email? Even something short, like modifying

Scenario: You should be able to edit a chapter to add a co-creator who is not
to check that 1 email is sent and And the email should contain "You have been listed as a co-creator on the following work"?

If you don't have time, we can make a new issue for tests.

@sarken sarken merged commit bbebb4a into otwcode:master Aug 31, 2017

4 checks passed

Scrutinizer No new issues
Details
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
hound 1 violation found.

@redsummernight redsummernight deleted the redsummernight:AO3-5130-cocreator-chapter-email branch Aug 31, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment