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

Deletion of spam sample duplicates #63

Closed
glebsterx opened this issue Mar 22, 2024 · 3 comments · Fixed by #64
Closed

Deletion of spam sample duplicates #63

glebsterx opened this issue Mar 22, 2024 · 3 comments · Fixed by #64

Comments

@glebsterx
Copy link

If in the admin chat you confirm the ban of users who write the same messages, such messages are added twice. And when you try to remove a duplicate from the sample database, both messages (both lines) are deleted. This is not a problem if you remember this - it is a nuance of placing the sample database in a text file.

Я перейду на русский если автор не против.
Предложил бы хранить семплы как-то по-другому, но идей кроме файловой базы у меня нет.. Да и не шарю я в этом вашем Golang
Честно говоря думаю автор не рассчитывал, что образцов спама будет так много =)
Возможно стоит в будущем предусмотреть какую-то очистку базы от дубликатов, либо проверку на существование идентичной записи при добавлении. Потому что невозможно вспомнить -- что уже было, а что нет.
Спасибо за внимание =)

@umputun
Copy link
Owner

umputun commented Mar 22, 2024

yeah, the proper solution would be to add a check if the same message already in samples and don't add it for the second time.

@glebsterx
Copy link
Author

Thanks a lot!

@umputun
Copy link
Owner

umputun commented Mar 22, 2024

the fix in place, released as a part of v1.11.1 hotfix

umputun added a commit that referenced this issue Mar 31, 2024
The code now checks if the specified file exists before appending a message. If it doesn't exist, it tries to create it, handling related errors accordingly. Corresponding tests to verify the new functionality have also been added, effectively ensuring its correct operation.

The failure to update spam for non-existing file was a side effect from duplication check #63
umputun added a commit that referenced this issue Mar 31, 2024
The code now checks if the specified file exists before appending a message. If it doesn't exist, it tries to create it, handling related errors accordingly. Corresponding tests to verify the new functionality have also been added, effectively ensuring its correct operation.

The failure to update spam for non-existing file was a side effect from duplication check #63

fix test typo from prev commit
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 a pull request may close this issue.

2 participants