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

Telegram: Restore the user_id property when resolving users #371

Conversation

ianroberts
Copy link
Contributor

SearchTelegram.resolve_groups takes the minimal ID information in PeerUser and PeerChannel objects within a Telegram message and expands them to their full user/channel objects respectively. In the case of channels the method re-inserts the original channel_id property into the JSON, which is useful as it means that code that processes the output JSON but only cares about the channel ID can work unchanged whether it is given resolved or unresolved JSON as input.

However this is not currently done for users, so downstream code needs to be aware of this and pull the ID from either user_id or full_user.id as appropriate.

This PR extends the channel behaviour to users, re-inserting the original user_id property in its original place.

@ianroberts ianroberts force-pushed the telegram-keep-resolved-user-id branch from 0fa57f5 to 5d7d639 Compare July 19, 2023 15:52
@ianroberts
Copy link
Contributor Author

Rebased on latest master

@stijn-uva
Copy link
Member

Hi @ianroberts , thanks for this and apologies for the delay. If you could sync your branch with the master branch once more I will merge this.

When resolving a PeerUser to a full_user, resolve_groups will now re-insert the original user_id property in the generated dictionary (so the ID is always accessible at the same JSON path whether or not we chose to resolve references).  This mirrors the existing behaviour for resolving channels.
@ianroberts ianroberts force-pushed the telegram-keep-resolved-user-id branch from 5d7d639 to 5060b96 Compare August 22, 2023 14:04
@ianroberts
Copy link
Contributor Author

Done, thanks.

@stijn-uva stijn-uva merged commit 8dca115 into digitalmethodsinitiative:master Aug 22, 2023
1 check passed
ianroberts added a commit to GateNLP/4cat that referenced this pull request Aug 22, 2023
@stijn-uva stijn-uva added this to the 1.37 milestone Oct 9, 2023
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