Skip to content

Conversation

@Process-ing
Copy link
Contributor

@Process-ing Process-ing commented Dec 27, 2025

Description

Backend support for the frontend PR #596. Modifies the exchange request routes to accept the attribute replace, which, when set to true, allows the server to cancel a previous request with the same hash as the new, preventing the new insertion from failing.

Important

When testing this branch, don't forget to also checkout the frontend to the branch feature/confirmation-popup

Changes Made

  • Changed MarketplaceExchangeView and DirectExchangeView, to accept the replace attribute on the POST method, not verifying hash collisions when set to true, and, instead, cancelling/rejecting the old request
  • Separate hash collision checking between normal and urgent marketplace requests (currently, when a request is submitted, its hash is checked against the hashes of both normal and urgent requests, independently of its type)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds backend support for a frontend confirmation popup when users attempt to submit duplicate exchange requests. It introduces a replace parameter to the exchange request endpoints that, when set to true, automatically cancels/rejects the user's previous pending request with the same hash before creating the new one. Additionally, it separates hash collision checking between normal and urgent marketplace requests.

Key Changes:

  • Added replace parameter handling to DirectExchangeView and MarketplaceExchangeView POST methods
  • Implemented automatic cancellation of old pending exchanges when replace=true
  • Fixed hash collision detection to check separately for normal vs urgent marketplace requests

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
django/university/routes/exchange/DirectExchangeView.py Adds replace parameter support and logic to cancel previous direct exchanges with the same hash before creating new ones
django/university/routes/MarketplaceExchangeView.py Adds replace parameter support, separates normal/urgent request duplicate checking, and implements helper methods to cancel/reject old marketplace and urgent requests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Process-ing Process-ing requested a review from a team December 28, 2025 18:40
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