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

Connect phonenumber to notificationprofile #104

Merged
merged 2 commits into from
Aug 10, 2020

Conversation

hmpf
Copy link
Contributor

@hmpf hmpf commented Aug 6, 2020

Not done: validating that a phone number is owned by the notificationprofile's owner.

@codecov-commenter
Copy link

codecov-commenter commented Aug 6, 2020

Codecov Report

Merging #104 into master will increase coverage by 0.18%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #104      +/-   ##
==========================================
+ Coverage   73.96%   74.15%   +0.18%     
==========================================
  Files          34       34              
  Lines        1260     1327      +67     
==========================================
+ Hits          932      984      +52     
- Misses        328      343      +15     
Impacted Files Coverage Δ
src/argus/notificationprofile/admin.py 81.48% <57.14%> (-8.77%) ⬇️
src/argus/notificationprofile/fields.py 64.00% <66.66%> (+1.50%) ⬆️
src/argus/notificationprofile/models.py 92.92% <100.00%> (+0.06%) ⬆️
src/argus/notificationprofile/serializers.py 50.66% <100.00%> (+0.66%) ⬆️
src/argus/incident/serializers.py 71.02% <0.00%> (-10.68%) ⬇️
src/argus/incident/models.py 78.57% <0.00%> (+0.21%) ⬆️
src/argus/incident/views.py 69.44% <0.00%> (+12.17%) ⬆️

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 1371939...2da9cb5. Read the comment docs.

@hmpf hmpf marked this pull request as ready for review August 7, 2020 11:36
@hmpf hmpf changed the title WIP: Connect phonenumber to notificationprofile Connect phonenumber to notificationprofile Aug 7, 2020
@hmpf
Copy link
Contributor Author

hmpf commented Aug 7, 2020

Checking that a user may change the phone number is done identically with how it's done for timeslots and filters.

@hmpf hmpf force-pushed the notify-phonenumber branch from ba22adc to 01c66c5 Compare August 7, 2020 11:45
@hmpf hmpf requested review from ddabble and jorgenbele August 7, 2020 12:00
Copy link
Contributor

@ddabble ddabble left a comment

Choose a reason for hiding this comment

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

A few comments 🙂 Looks good otherwise! ✨

src/argus/notificationprofile/admin.py Outdated Show resolved Hide resolved
src/argus/notificationprofile/admin.py Outdated Show resolved Hide resolved
@@ -167,6 +167,7 @@ class Media(models.TextChoices):
# TODO: support for multiple email addresses / phone numbers / Slack users
media = MultiSelectField(choices=Media.choices, min_choices=1, default=Media.EMAIL)
active = models.BooleanField(default=True)
phone_number = models.ForeignKey("argus_auth.PhoneNumber", on_delete=models.SET_NULL, blank=True, null=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we change this to parameter to a reference, to be consistent with the other ForeignKey fields?

Suggested change
phone_number = models.ForeignKey("argus_auth.PhoneNumber", on_delete=models.SET_NULL, blank=True, null=True)
phone_number = models.ForeignKey(to=PhoneNumber, on_delete=models.SET_NULL, blank=True, null=True)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I'd rather get rid of "to", and use strings whenever we point to something in a different app. Lowers chance of import-loops, since the strings are IIRC lazily imported.

@hmpf hmpf requested a review from ddabble August 10, 2020 06:17
@hmpf hmpf force-pushed the notify-phonenumber branch from 8f867cb to 7aef582 Compare August 10, 2020 11:32
Copy link
Contributor

@ddabble ddabble left a comment

Choose a reason for hiding this comment

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

Great! 😄

@hmpf hmpf force-pushed the notify-phonenumber branch from 7aef582 to 2da9cb5 Compare August 10, 2020 11:37
@ddabble ddabble merged commit b3100b7 into Uninett:master Aug 10, 2020
@hmpf hmpf deleted the notify-phonenumber branch August 13, 2020 06:01
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