Skip to content

Fix mistypo in handle_topic_subscription - #299

Merged
xtrinch merged 2 commits into
xtrinch:masterfrom
kerokim:master
Apr 7, 2026
Merged

Fix mistypo in handle_topic_subscription#299
xtrinch merged 2 commits into
xtrinch:masterfrom
kerokim:master

Conversation

@kerokim

@kerokim kerokim commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Hello!

In FCMDeviceQuerySet.handle_topic_subscription method, extending the return value of the messaging.subscribe_to_topic and messaging.unsubscribe_from_topic functions to the message list 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)에 함수 인자가 전달됩니다.

감사합니다.

Copilot AI review requested due to automatic review settings April 7, 2026 05:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 responses in messaging.BatchResponse(...) before returning, but topic subscribe/unsubscribe operations produce a TopicManagementResponse (and callers like fcm_django/admin.py expect .errors / .failure_count on the topic response). After fixing the call precedence above, consider returning an aggregated TopicManagementResponse (consistent with get_default_topic_response() and AbstractFCMDevice.handle_topic_subscription) rather than a BatchResponse, otherwise bulk admin topic actions and FirebaseResponseDict.failed_registration_ids may 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.

Comment thread fcm_django/models.py Outdated
@kerokim
kerokim marked this pull request as draft April 7, 2026 06:05
@xtrinch

xtrinch commented Apr 7, 2026

Copy link
Copy Markdown
Owner

Pushed a fix this should now be consistent with pre-3.0.0 release

@xtrinch
xtrinch marked this pull request as ready for review April 7, 2026 06:38
@xtrinch
xtrinch merged commit 43cda60 into xtrinch:master Apr 7, 2026
6 checks passed
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