Skip to content

Respond to Reviews CR#7825

Merged
sloria merged 3 commits into
CenterForOpenScience:feature/reviewsfrom
laurenbarker:improvement/respond-cr
Oct 19, 2017
Merged

Respond to Reviews CR#7825
sloria merged 3 commits into
CenterForOpenScience:feature/reviewsfrom
laurenbarker:improvement/respond-cr

Conversation

@laurenbarker

@laurenbarker laurenbarker commented Oct 18, 2017

Copy link
Copy Markdown
Contributor

Before this is merged let Steve know so he can rollback the staging3 database to 0060_reviews to prevent the name changes from breaking things.

Staging3 doesn't have very many users but if needed, 0061_add_reviews_notification_subscription can be skipped/faked and subscriptions can be added using python manage.py add_notification_subscription --notification global_reviews.

Purpose

Respond to CR on #7807.

Note that this PR doesn't update the myProjects page to use 2.6. I think that would need a regression test from QA which is out of scope of reviews changes.

Changes

  • Update global_reviews notification display text
  • Rename migrations
  • Use variable for related node
  • Use constant in mails.py
  • Change message field on NotificationDigest to TextField
  • Add management command for adding subscriptions to users add_notification_subscription --notification global_reviews

Side effects

Probably messes up your migration history. I just deleted the relevant migration history from django_migrations table using DataGrip and reran migrate.*

*Probably not the recommended way to handle inconsistent history.

@laurenbarker
laurenbarker force-pushed the improvement/respond-cr branch 2 times, most recently from 0071281 to 52ae276 Compare October 19, 2017 18:21
@laurenbarker laurenbarker changed the title [WIP] Respond to CR Respond to CR Oct 19, 2017
@laurenbarker laurenbarker changed the title Respond to CR Respond to Reviews CR Oct 19, 2017
@laurenbarker

Copy link
Copy Markdown
Contributor Author

@sloria this is ready for review 🐧

Comment thread website/mails/mails.py Outdated
subject='Share Error'
)

REVIEWS_SUBMISSION_CONFIRMATION = lambda provider_name: Mail(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lambda shouldn't be necessary. The subject can be a string template that receives the same context as the email body.

For example

FILE_OPERATION_SUCCESS = Mail(
    'file_operation_success',
    subject='Your ${action} has finished',
)

Rename migrations

Use variable for related node

Use constant in mails.py

Change message field on NotificationDigest from char to text

Add management command for adding subscriptions to users
@laurenbarker
laurenbarker force-pushed the improvement/respond-cr branch from 52ae276 to 1e82ff7 Compare October 19, 2017 18:54

@sloria sloria left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nitpick to address

Comment thread reviews/models/mixins.py Outdated
user_subscriptions = get_user_subscriptions(user, event_type)
context['no_future_emails'] = user_subscriptions['none']
context['is_creator'] = user == context.get('reviewable').node.creator
context['provider_name']= context.get('reviewable').provider.name

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is reviewable guaranteed to be in the context?

If so, then context['reviewable'] is preferred, to make it clear that it's guaranteed.
If not, then this code will need to be changed to handle the case when it's not there.

@laurenbarker
laurenbarker force-pushed the improvement/respond-cr branch 2 times, most recently from d5bdee5 to 37b6874 Compare October 19, 2017 20:29
@laurenbarker
laurenbarker force-pushed the improvement/respond-cr branch from 37b6874 to 25e9014 Compare October 19, 2017 20:30
@sloria

sloria commented Oct 19, 2017

Copy link
Copy Markdown
Contributor

OK, stage3 is now rolled back to 0060. Let's move on..

@sloria
sloria merged commit 0e7089f into CenterForOpenScience:feature/reviews Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants