Fix mistypo in handle_topic_subscription - #299
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates FCMDeviceQuerySet.handle_topic_subscription to fix an operator-precedence typo so that messaging.subscribe_to_topic / messaging.unsubscribe_from_topic are actually invoked with the batch arguments, rather than attempting to call the None return of list.extend().
Changes:
- Wraps the conditional function selection in parentheses so the selected function is called with
(batch_ids, topic, ...). - Adjusts parentheses/indentation around the
responses.extend(...)call to reflect the intended evaluation order.
Comments suppressed due to low confidence (1)
fcm_django/models.py:582
- This method currently wraps
responsesinmessaging.BatchResponse(...)before returning, but topic subscribe/unsubscribe operations produce aTopicManagementResponse(and callers likefcm_django/admin.pyexpect.errors/.failure_counton the topic response). After fixing the call precedence above, consider returning an aggregatedTopicManagementResponse(consistent withget_default_topic_response()andAbstractFCMDevice.handle_topic_subscription) rather than aBatchResponse, otherwise bulk admin topic actions andFirebaseResponseDict.failed_registration_idsmay break.
)
return FirebaseResponseDict(
response=messaging.BatchResponse(responses),
registration_ids_sent=registration_ids,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kerokim
marked this pull request as draft
April 7, 2026 06:05
Owner
|
Pushed a fix this should now be consistent with pre-3.0.0 release |
xtrinch
marked this pull request as ready for review
April 7, 2026 06:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello!
In FCMDeviceQuerySet.handle_topic_subscription method, extending the return value of the
messaging.subscribe_to_topicandmessaging.unsubscribe_from_topicfunctions to themessagelist variable.In the above work, I modified it because there was a mistypo of the part that carries the function parameter to the function object.
Currently, the response list variable attempts to extend the function object, and the function argument is passed to the return value(NoneType).
Thank you.
안녕하세요!
FCMDeviceQuerySet.handle_topic_subscription 메소드에는 messaging.subscribe_to_topic, messaging.unsubscribe_from_topic 함수의 return 값을 response 리스트 변수에 extend하는 작업이 있습니다.
위 작업에서 함수 객체에 함수 파라미터를 전달하는 부분의 mistypo가 있어 수정했습니다.
현재는 response 리스트 변수에는 함수 객체를 extend 시도하고, extend의 return 값(NoneType)에 함수 인자가 전달됩니다.
감사합니다.