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

Add some basic limits to anonymous tag changes #184

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

liamwhite
Copy link
Contributor

No description provided.

lib/philomena/images.ex Outdated Show resolved Hide resolved
lib/philomena/limits.ex Outdated Show resolved Hide resolved
lib/philomena/limits.ex Outdated Show resolved Hide resolved
Copy link
Member

@Meow Meow left a comment

Choose a reason for hiding this comment

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

lgtm (assuming you tested this, i don't see any obvious faults in code)

@liamwhite
Copy link
Contributor Author

Looking over again, I think rating counts aren't checked correctly (always fails the update if a rating tag was changed in the last 10 minutes, even if no rating tag was changed in the current update)

Copy link
Member

@Meow Meow left a comment

Choose a reason for hiding this comment

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

Looking closer at it, this has not a snowflake's chance in hell to work. Here are the glaring issues which I have noticed looking at the code:

  1. It's not actually checked if the current change batch contains any rating tags, rather the tagging is rejected if the user has changed any rating tags at all in the past indiscriminately.

I've added a couple of comments on relevant lines and my suggestions for fixes.

Limits.is_limited_for_tag_count?(user, ip) ->
{:error, "Limit exceeded"}

Limits.is_limited_for_rating_count?(user, ip) ->
Copy link
Member

Choose a reason for hiding this comment

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

This needs to check if the current batch contains rating tag changes, otherwise it'll fail the update if user changed rating tag somewhere, but not in this batch.

lib/philomena/images.ex Show resolved Hide resolved
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.

None yet

2 participants