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 independent methods for saving a chat and forming its name #647

Merged
merged 3 commits into from
Sep 18, 2024

Conversation

andrey-helldar
Copy link
Contributor

The current version of the code hardcodes the name of the chat when saving to the database. For example, [supergroup] Foo.

This is inconvenient when you need to display the list of channels without prefixes.

In such cases we have to create casts for the name field of the model to apply a regular expression to remove the prefix.

To solve this problem, I propose to consider two interrelated actions at once:

  1. Put the formation of the chat name into an external protected method that developers can easily override to change the logic.
  2. also put the method of chat creation into an external method in case some of the developers need to add their own logic when saving, having access to the DefStudio\Telegraph\DTO\Chat object.

@fabio-ivona fabio-ivona merged commit b867a0d into defstudio:main Sep 18, 2024
16 checks passed
@andrey-helldar andrey-helldar deleted the patch/2024-09-16/20-33 branch September 18, 2024 21:55
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