Skip to content

Can't create tags anonymously #682

Open
@CrawlerBleak

Description

It seems the codebase assumes that tag creators are logged in:

[2024-10-13 14:51:47 -0700] [546457] [ERROR] Error handling request /post/232
Traceback (most recent call last):
  File "/home/booru/.venv/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 281, in handle
    keepalive = self.handle_request(req, conn)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/booru/.venv/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 333, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/booru/server/szurubooru/rest/app.py", line 104, in application
    response = handler(ctx, match.groupdict())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/booru/server/szurubooru/api/post_api.py", line 145, in update_post
    snapshots.create(tag, ctx.user)
  File "/opt/booru/server/szurubooru/func/snapshots.py", line 126, in create
    _post_to_webhooks(snapshot)
  File "/opt/booru/server/szurubooru/func/snapshots.py", line 100, in _post_to_webhooks
    net.post_to_webhooks(serialize_snapshot(snapshot, webhook_user))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/booru/server/szurubooru/func/snapshots.py", line 90, in serialize_snapshot
    "user": users.serialize_micro_user(snapshot.user, auth_user),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/booru/server/szurubooru/func/users.py", line 174, in serialize_micro_user
    return serialize_user(
           ^^^^^^^^^^^^^^^
  File "/opt/booru/server/szurubooru/func/users.py", line 168, in serialize_user
    return UserSerializer(user, auth_user, force_show_email).serialize(options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/booru/server/szurubooru/func/serialization.py", line 25, in serialize
    ret[key] = factory()
               ^^^^^^^^^
  File "/opt/booru/server/szurubooru/func/users.py", line 139, in serialize_avatar_url
    return get_avatar_url(self.user)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/booru/server/szurubooru/func/users.py", line 51, in get_avatar_url
    assert user.name
AssertionError

I would like my booru to be editable anonymously. To that end, I need people to be able to submit new tags for posts. How can I achieve that?

P.S. I correctly have tags:create and posts:edit:tags set to anonymous.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions