defendtheweb / hackthis.co.uk

HackThis!!
http://www.hackthis.co.uk
Other
46 stars 55 forks source link

Fix "Add friend" button visible to profile owner #145

Closed SeinopSys closed 10 years ago

SeinopSys commented 10 years ago

I just found out that apparently you can add yourself as a friend, and since I think that's a bug, I've taken a step towards fixing it.

The reason why I didn't add the additional condition to line 64 instead is that it'd cause people who have already found this bug and added themselves as a friend to be unable to undo it. For this reason, the button is only hidden when either

  1. A user haven't yet added themselves as a friend
  2. or they removed themselves as a friend and are no longer friends

A server side check should also be added in order to prevent this, but since I don't understand the logic behind the profile class' code, I wasn't able to do it.

I added some server side detection, but I'm not a 100% sure it'll work as expected.

verath commented 10 years ago

I think this has been discussed previously (like quite a long time ago) somewhere on the forums. If I remember correctly, it was decided that this was actually a feature and not a bug. :)

Another thing, your indentation seems a bit off compared to the rest of the file..? I believe most of the HT code is using 4 spaces for indentation. Maybe not a big thing, but imo it looks prettier if the same method is used throughout the file.

SeinopSys commented 10 years ago

My notepad is set to 4 wide tabs for indentation.

I did not know this was a feature, so closing the pull request.