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 tag blocklist for registered and anonymous users #613

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Soblow
Copy link

@Soblow Soblow commented Nov 6, 2023

This patchset introduces a "tag blocklist".
Features:

  • Tags blocklist per user
    • When a user adds a tag to their blocklist, they won't see posts with this tag by default when browsing or searching posts
    • If they want to see posts with a tag from their blocklist, they can still add the tag to the search request and the posts will be shown
    • Can be edited on a user profile (with tag autocomplete like when editing posts)
    • If a user adds a non-existing tag to their blocklist, the tag is automatically created
  • Configurable default tag blocklist applied by default to newly created users
    • This is a string field in configuration. Non-existing tags aren't created
  • The default tag blocklist can be applied to anonymous users (also configurable)
  • Properly handled user/tags deletion

Everything is added to a separate database table for easier management.

Fixes: #317
Replaces: #583

@Soblow
Copy link
Author

Soblow commented Nov 6, 2023

Regarding tests, I provide only fixes for existing tests, as well as 2 minimal tests, because for some reason, tests are failing with nonsensical states (posts created from a previous test reappearing way later, blocklist tests executed before non-related other tests will break them...)
I think this is due to bad interactions with the database, snapshots and other things but it is out of my technical knowledge and experience...

@SpaghettiMonkey
Copy link

Hello, I'm trying to use this fork but I can't find any UI element related to blocklists. I had to remove the "THREADS" line from the docker-compose.yml file, is this the reason this feature doesn't work ?

@Soblow
Copy link
Author

Soblow commented Feb 3, 2024

Hello, I'm trying to use this fork but I can't find any UI element related to blocklists. I had to remove the "THREADS" line from the docker-compose.yml file, is this the reason this feature doesn't work ?

Hi! The blocklist should be located on a user profile directly. You can also access instance-wide settings in the config file.

Also, did you properly build the containers? Default docker compose pulls official images, but to test the features you gotta build containers from the repo

@SpaghettiMonkey
Copy link

Hi! The blocklist should be located on a user profile directly. You can also access instance-wide settings in the config file.

Also, did you properly build the containers? Default docker compose pulls official images, but to test the features you gotta build containers from the repo

I don't think I did that, but I don't know how to build from a pull request. How am I supposed to do that ?

@Soblow
Copy link
Author

Soblow commented Feb 24, 2024

I don't think I did that, but I don't know how to build from a pull request. How am I supposed to do that ?

The same way as you'd do for main Szurubooru repo, but instead you use the repo and branch from which this PR takes the changes. You clone our repo, switch to the PR branch, and proceed to build the docker from here (see /doc/INSTALL.md file, "Building" section) .

@SpaghettiMonkey
Copy link

I don't think I did that, but I don't know how to build from a pull request. How am I supposed to do that ?

The same way as you'd do for main Szurubooru repo, but instead you use the repo and branch from which this PR takes the changes. You clone our repo, switch to the PR branch, and proceed to build the docker from here (see /doc/INSTALL.md file, "Building" section) .

Sorry, didn't see that. I do however have another problem now.
When building, I keep getting this error : "Could not build wheels for pillow-avif-plugin which use PEP 517 and cannot be installed directly".

@Lugrim
Copy link

Lugrim commented Feb 26, 2024

Sorry, didn't see that. I do however have another problem now. When building, I keep getting this error : "Could not build wheels for pillow-avif-plugin which use PEP 517 and cannot be installed directly".

Yes, this was a problem with the dockers used to build. It was fixed on master branch. I just rebased, it should be fixed now.

@SpaghettiMonkey
Copy link

Yes, this was a problem with the dockers used to build. It was fixed on master branch. I just rebased, it should be fixed now.

Thanks, I could make it work ! Had to remove that "THREAD" thing in the yaml though, but again, thank you guys for your work.

@Lugrim Lugrim force-pushed the feature/blocklist branch from 34d0cca to 1c0b113 Compare March 3, 2024 15:53
Soblow added 5 commits May 5, 2024 19:34
- "default_tag_blocklist": string containing a list of space-separated tags to add to a newly created user blocklist
- "default_tag_blocklist_for_anonymous": boolean telling if the above mentionned default blocklist is applied to anonymous users
- Added permissions to edit own blocklist, or others
- New field in User profile edition to add/remove tags from their blocklist
- This field works as other tag fields, with auto-completion, and a proper list under the textbox
- User must have the right permissions to edit blocklist (either their own or other users')
- Add default blocklist to user when created
- Tags are created if added to a user blocklist
- Add matching migration to DB to add the user blocklist table
- Various other things
@Lugrim Lugrim force-pushed the feature/blocklist branch from 1c0b113 to e2b0a6a Compare May 5, 2024 17:35
@WawaCallMePepe
Copy link

can i ask how soon this will be pushed to master branch, so my docker container could update?

@bakedhorse
Copy link

bakedhorse commented Jun 6, 2024

can i ask how soon this will be pushed to master branch, so my docker container could update?

@WawaCallMePepe
Updates/merges for szurubooru are pretty... slow. The maintainers are very busy.
So for the moment, it's just best to fork the project and merge any PRs into your fork. Along with using build instead of the image, which allows you to change the theme/colors of szurubooru as well. Only downside is having to maintain your own fork.

@WawaCallMePepe
Copy link

is there any way to blacklist tag categories?

i would like to add category:something to default_tag_blocklist in config.yaml to wipe all images in specified category (or in user settings in webUI)

any help or suggestions would be greatly appreciated

@bakedhorse
Copy link

is there any way to blacklist tag categories?

i would like to add category:something to default_tag_blocklist in config.yaml to wipe all images in specified category (or in user settings in webUI)

any help or suggestions would be greatly appreciated

@WawaCallMePepe
Sorry for the very late reply. I haven't had a working fork with this newer PR.
From what I can find, you can add prefixes like "artist\:*" and that will work. However this creates a tag called "artist\:*".
I tried using "category:artist", but it just gets immediately deleted from the blacklist.

Definitely something to be looked into, as these are oversights imo. For the time being, doesn't seem possible to block categories, or prefixes without a dummy tag being made.

@WawaCallMePepe
Copy link

Found a bug (maybe fixable somehow):

when 'users:edit:self:blocklist' is set to moderator, normal users cant edit their avatar or email

@bakedhorse
Copy link

Found a bug (maybe fixable somehow):

when 'users:edit:self:blocklist' is set to moderator, normal users cant edit their avatar or email

@WawaCallMePepe
Odd. I've tried this and it works as expected, with the blocklist not being visible. Avatar and email editing works just fine.
Are you using this PR specifically or the old version? Also have you cleared browser cache to make sure?

@WawaCallMePepe
Copy link

@WawaCallMePepe Odd. I've tried this and it works as expected, with the blocklist not being visible. Avatar and email editing works just fine. Are you using this PR specifically or the old version? Also have you cleared browser cache to make sure?

Created docker image from ec33fe5 commit on https://github.com/Lugrim/szurubooru

Tried with fresh user in private firefox session, still getting "Insufficient privileges to do this." error

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.

Feature request: User-based tag blacklisting
5 participants