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

Fix imports of FCM to keep it as an optional dependency #706

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

sevdog
Copy link
Contributor

@sevdog sevdog commented Feb 23, 2024

As pointed out in this comment #702 (comment) importing firebase_admin or gcm at top level in models.py turns the firebase_admin package as a mandatory requirements while it should not.

To address this I have moved the imports inside the appropriated methods. This allow the codebase to run even without the firebase package (which is optional).

Copy link

codecov bot commented Feb 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.28%. Comparing base (9fbab31) to head (c54230f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #706      +/-   ##
==========================================
- Coverage   70.33%   70.28%   -0.06%     
==========================================
  Files          26       26              
  Lines        1099     1097       -2     
  Branches      249      249              
==========================================
- Hits          773      771       -2     
  Misses        288      288              
  Partials       38       38              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1,9 +1,7 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
from firebase_admin import messaging
Copy link
Member

Choose a reason for hiding this comment

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

This has instead been fixed with #707

@50-Course
Copy link
Member

Thank you for making this MR. The patch was instead resolving two issues, making firebase_admin optional as well as moving the required .gcm methods to appropriate area.

#707 resolved the firebase_admin issue, not required. That said, once this conflict herein is fixed. It is good as merged

@sevdog
Copy link
Contributor Author

sevdog commented Feb 27, 2024

I have rebased over #707, now this PR makes a single import statement instead of two to handle FCM in models.py.

@50-Course
Copy link
Member

I have rebased over #707, now this PR makes a single import statement instead of two to handle FCM in models.py.

I would make one more quick pass, and merge into the main trunk.

Once again, thank you for pulling in this patch.

Copy link
Member

@50-Course 50-Course left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼

@50-Course 50-Course merged commit 820262e into jazzband:master Feb 27, 2024
7 checks passed
@sevdog sevdog deleted the fix-fcm-imports branch February 27, 2024 14:14
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