AjobK / Seaqull

Seaqull programming blog
http://www.seaqull.com
4 stars 0 forks source link

389 post timeout #391

Closed MrGooss closed 2 years ago

MrGooss commented 2 years ago

closes #389


What is it supposed to do
Adds a timeout for users trying to spam posts.

Used the branch from issue #386 to get a toast when someone tries to spam posts, duration of the timeout can be updated in the .env file image


How can we test your branch
Create a post and try to create another post directly after. This should display an error and not create the post.


Additional notes
UPDATE THE ENV FILE


1. General checklist


2. If relevant, front-end checklist


3. If relevant, back-end checklist


4. If relevant, test these browsers


PR Rules
1. Add relevant labels.
2. Select at least two reviewers.
3. Assign all reviewers allowed to merge the branch, including yourself.
4. If relevant to the sprint, put related issue in 'Awaiting Approval' column on project board.
5. Add to the corresponding milestone.


Reviewer info
1. You can use aliases to refer to specific PR checklist items. For example 'Hey @JohnDoe, for this line please check 3.a and 1.d.'
2. Where possible, please use the suggestions feature in github so the author has a better idea of the solution you had in mind.


This form should be filled in by the author of this PR.

AjobK commented 2 years ago

It doesn't cause an error..?

image

I created like 7 posts in a row

MrGooss commented 2 years ago

Make global config class with timeout setting

AjobK commented 2 years ago

@S-Goossens Try to make the TODO a little clearer next time. 'UPDATE ENV' lacks description. Anyway, I'm probably gonna remove the timeout from the env file as it's only used in one place right now. It also requires some configuration which we don't really need.

AjobK commented 2 years ago

The post timeout didn't work at first. You were comparing milliseconds, but this is not the total milliseconds of all time, only in the current second. So you would get 'random' msDiffs. Code now works.