Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alert review #3160

Merged
merged 10 commits into from
Jul 5, 2022
Merged

Add alert review #3160

merged 10 commits into from
Jul 5, 2022

Conversation

LePetitTim
Copy link
Contributor

No description provided.

@cypress
Copy link

cypress bot commented Jun 23, 2022



Test summary

22 0 0 0


Run details

Project Geotrek-admin
Status Passed
Commit 651cb9d
Started Jul 5, 2022 10:07 AM
Ended Jul 5, 2022 10:10 AM
Duration 03:08 💡
OS Linux Ubuntu - 20.04
Browser Electron 94

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@codecov
Copy link

codecov bot commented Jun 23, 2022

Codecov Report

Merging #3160 (651cb9d) into master (c139392) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #3160   +/-   ##
=======================================
  Coverage   97.82%   97.83%           
=======================================
  Files         273      273           
  Lines       19075    19087   +12     
=======================================
+ Hits        18661    18673   +12     
  Misses        414      414           
Impacted Files Coverage Δ
geotrek/common/mixins/models.py 97.73% <100.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c139392...651cb9d. Read the comment docs.

@LePetitTim LePetitTim requested a review from a team June 24, 2022 12:03
geotrek/common/mixins/models.py Outdated Show resolved Hide resolved
@override_settings(ALERT_REVIEW=True)
def test_status_review_alert(self):
element_not_published = self.modelfactory.create()
element_not_published.published = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Je l'aurais plutôt mis dans la factory et enlevé cette ligne

Suggested change
element_not_published.published = False
element_not_published = self.modelfactory.create(published=False)

Copy link
Contributor

@Chatewgne Chatewgne Jun 24, 2022

Choose a reason for hiding this comment

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

+ ajouter le changelog

@LePetitTim LePetitTim requested review from Chatewgne and a team June 30, 2022 14:11
@@ -317,6 +319,14 @@ class PublishableMixin(BasePublishableMixin):
class Meta:
abstract = True

def save(self, *args, **kwargs):
old_object = self.__class__.objects.filter(pk=self.pk)
if (old_object and getattr(old_object, 'review', None) != self.review and self.review) and settings.ALERT_REVIEW:
Copy link
Member

Choose a reason for hiding this comment

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

you can't acces review attribute from a queryset, you should get instance from qs

if (self.pk and self.__class__.objects.get(pk=self.pk).review != self.review and self.review) and settings.ALERT_REVIEW:
subject = _("{obj} need a review").format(obj=self)
message = render_to_string('common/review_email_message.txt', {"obj": self})
mail_managers(subject, message, fail_silently=False)
Copy link
Member

Choose a reason for hiding this comment

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

fail_silently=False -> unable to modify review attribute if mail server or configuration has problem

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.

3 participants