revsys / django-friendship

Django app to manage following and bi-directional friendships
BSD 3-Clause "New" or "Revised" License
763 stars 183 forks source link

Feature request: Allow resubmission of friend requests after rejection #193

Open pfcodes opened 1 year ago

pfcodes commented 1 year ago

Problem

Currently, within this library, once a friend request is rejected, there's no option to allow the resubmission of that friend request. This can lead to a problematic situation where a user accidentally rejects a friend request and can't receive a new request from the same user.

Suggested Feature/Enhancement

It would be beneficial to add functionality that allows users to resubmit a friend request after it has been rejected. This could be implemented with an optional setting that, when enabled, either allows immediate resubmission or sets a cooldown period after which a new request can be sent. Or it can also be as simple as changing these rejected__isnull to the guards in FriendshipManager.add_friend:

        if FriendshipRequest.objects.filter(
            from_user=from_user, to_user=to_user, rejected__isnull=False 
        ).exists():
            raise AlreadyExistsError("You already requested friendship from this user.")

        if FriendshipRequest.objects.filter(
            from_user=to_user, to_user=from_user, rejected__isnull=False 
        ).exists():
            raise AlreadyExistsError("This user already requested friendship from you.")

Alternatives Considered

Some might argue that allowing the resubmission of friend requests could open the door to spamming. However, a simple yet effective solution to this concern is to utilize the existing blocking functionality. If a user does not want to receive further requests from someone, they have the option to block that individual. This way, users are empowered to prevent spam without hindering genuine connection attempts due to accidental rejections.

Additional Context

This change would enhance the user experience by adding flexibility and forgiveness to the friend request process, which, as of now, is quite rigid and unforgiving of mistakes. The ability to control whether or not to allow resubmissions could be a setting at the admin level, providing the site operators with the ability to tailor the behavior according to their community's needs.