Skip to content

Avatar reset returns 500 after a custom avatar upload #17

Description

@cassi-volkova

Summary

Resetting a user avatar after uploading a custom avatar returns HTTP 500. The reset flow updates the user avatar value, but cleanup of the replaced public file calls the file-deletion event helper with the wrong arguments.

Steps to reproduce

  1. Use the Messenger platform implementation from PR Move Workspace messenger state to PostgreSQL and add provider API #16.
  2. Upload a valid image through the current user avatar upload action.
  3. Confirm the avatar file is stored and can be read by another authenticated Workspace user.
  4. Invoke the current user avatar reset action.

Expected result

The action returns HTTP 200, restores the generated avatar URN, emits the file deletion events, and removes the replaced binary and JSON sidecar.

Actual result

The action returns HTTP 500 with:

TypeError: create_file_deleted_events() missing 2 required positional arguments: file_uuid and recipient_user_uuids

delete_workspace_avatar_file() passes the file object and recipient list, while create_file_deleted_events() expects project_id, stream_uuid, file_uuid, and recipient_user_uuids.

Verification

The existing integration scenario test_avatar_upload_is_public_to_authenticated_users_and_reset_removes_it reproduces the failure after the upload and cross-user authenticated download assertions succeed. The mismatched call is present on the current PR head and is independent of generic public-file upload handling.

Suggested fix

Pass the deleted file project ID, nullable stream UUID, file UUID, and recipient UUIDs to create_file_deleted_events(), then keep the existing storage cleanup and integration assertions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions