Skip to content

Add lending archiving#4114

Open
Bestem0r wants to merge 1 commit into
masterfrom
add-lending-archiving
Open

Add lending archiving#4114
Bestem0r wants to merge 1 commit into
masterfrom
add-lending-archiving

Conversation

@Bestem0r

Copy link
Copy Markdown
Contributor

Description

Adds archiving of lending requests to clear up inbox.

Frontend PR.

Result

  • Changes look good on both light and dark theme.
  • Changes look good with different viewports (mobile, tablet, etc.).
  • Changes look good with slower Internet connections.
Screencast.From.2026-04-13.22-23-36.mp4

Testing

  • I have thoroughly tested my changes.****

@ch0rizo ch0rizo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Anyone who can PATCH can archive any request. The archived field is added directly to LendingRequestCreateAndUpdateSerializer without any permission guard. The existing validate() method only checks permissions on status changes - it doesn't restrict who can set archived. This means:

  • An admin/responsible person could archive a requester's request.
  • The requester could archive someone else's request if they somehow get access

self.instance, "lendable_object", None
)
user = self.context["request"].user

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if "archived" in attrs and self.instance:
if self.instance.created_by != user:
raise serializers.ValidationError(
{"archived": "You can only archive your own requests."}

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.

2 participants