In this episode, we tackle a small but important usability issue: allowing users to cancel (or remove) a pending friend request. We notice that once you send a friend request using an email, there's currently no direct way to cancel it from the UI, even though the backend logic already supports it by deleting the relevant entry from the database.
We dive into the friends list template and add the missing form/button in the 'Pending Friend Requests' section. Essentially, we reuse the form setup from elsewhere in the page, tweaking it a bit so that the action is labeled as 'Cancel' and routes through the proper delete method.
After patching up a variable name mistake, we make sure the pending friend's email is displayed for consistency. Now, everything looks good: we can see the 'Cancel' option next to each pending request, and hitting it removes the request for both users.
This episode is all about tying up this loose end in the friend request feature, making the UI behave as expected—and making our app feel much smoother!