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

Added message_thread_id to url of chats with topics for message.get_u… #1469

Open
wants to merge 5 commits into
base: dev-3.x
Choose a base branch
from

Conversation

Robotvasya
Copy link
Contributor

Description

Added message_thread_id to url of chats with topics for message.get_url() method.

Fixes #1451

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • pytest
  • black
  • manual

Test Configuration:

  • Operating System: Windows
  • Python version: Python 3.10

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@github-actions github-actions bot added the 3.x Issue or PR for stable 3.x version label Apr 23, 2024
Copy link

✔️ Changelog found.

Thank you for adding a description of the changes

@Robotvasya
Copy link
Contributor Author

Instead #1454
I don't know how to merge to discussion

Copy link
Member

@JrooTJunior JrooTJunior left a comment

Choose a reason for hiding this comment

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

Changes should be covered by tests

Copy link

codecov bot commented Apr 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (f1c9fc5) to head (609d65c).
Report is 3 commits behind head on dev-3.x.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           dev-3.x     #1469   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          422       422           
  Lines        10937     10938    +1     
=========================================
+ Hits         10937     10938    +1     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
aiogram/types/message.py 100.00% <100.00%> (ø)

@Olegt0rr
Copy link
Contributor

@Robotvasya, do you need help writing tests or can you handle it yourself?

@Olegt0rr Olegt0rr added the enhancement Make it better! label Apr 24, 2024
@Robotvasya
Copy link
Contributor Author

I will try. And then ask for help)

@Robotvasya
Copy link
Contributor Author

@Olegt0rr, I made some tests, please review it

Comment on lines 62 to 77
["supergroup", -100123456789, None, False, False, None, "https://t.me/c/123456789/10"],
["supergroup", -100123456789, None, False, False, 3, "https://t.me/c/123456789/10"],
["supergroup", -100123456789, None, False, True, None, "https://t.me/c/123456789/10"],
["supergroup", -100123456789, None, False, True, 3, "https://t.me/c/123456789/3/10"],
["supergroup", -100123456789, None, True, False, None, "https://t.me/c/123456789/10"],
["supergroup", -100123456789, None, True, False, 3, "https://t.me/c/123456789/10"],
["supergroup", -100123456789, None, True, True, None, "https://t.me/c/123456789/10"],
["supergroup", -100123456789, None, True, True, 3, "https://t.me/c/123456789/3/10"],
["supergroup", -100123456789, "name", False, False, None, "https://t.me/name/10"],
["supergroup", -100123456789, "name", False, False, 3, "https://t.me/name/10"],
["supergroup", -100123456789, "name", False, True, None, "https://t.me/name/10"],
["supergroup", -100123456789, "name", False, True, 3, "https://t.me/name/3/10"],
["supergroup", -10012345678, "name", True, False, None, "https://t.me/c/12345678/10"],
["supergroup", -100123456789, "name", True, False, 3, "https://t.me/c/123456789/10"],
["supergroup", -10012345678, "name", True, True, None, "https://t.me/c/12345678/10"],
["supergroup", -100123456789, "name", True, True, 3, "https://t.me/c/123456789/3/10"],
Copy link
Contributor

Choose a reason for hiding this comment

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

For what purpose chat_type and chat_id are parametrized here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This creates different types of updates.
I planned that a “channel” type could be added here in the future. And just add a few parameters, do not completely rewrite the test. Although, as I understand it, the channels do not have topics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this is redundant at the moment, then of course I will remove it inside the the function's body.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The refactoring done.
First group of tests covers all chat_types cases.
Second covers if the supergroup chat is a forum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issue or PR for stable 3.x version enhancement Make it better!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

message.get_url() in chat with topics -> wrong url
3 participants