Extension:SocialProfile/Refactoring UserRelationship

This documents a potential future refactor for UserRelationship. (work in progress!)

Workflow

 * 1) UserA send RelationshipRequest to UserB
 * 2) UserB receives RelationshipRequest (and possibly email)
 * 3) UserB sends response to RelationshipRequest from UserA
 * 4) Accept
 * 5) new Relationship between UserA and UserB
 * 6) Decline
 * 7) RelationshipRequest is removed from database

RelationshipLookup

 * Describe
 * This class will allow looking up info of a user's relationships with other users.


 * Function
 * This class should be able to do the following things:


 * Get a list of friends a user has
 * Get a list of foes a user has
 * Get a list of all relationships a user has
 * Get a list of 'open' RelationshipRequests

RelationshipRequestQueueCount

 * Describe
 * This helper object will allow increasing, decreasing, and getting the amount of requests present in the user's queue.

RelationshipRequestQueueLookup

 * Describe
 * This will allow looking up info of open relationship requests, which are in a 'queue'.

RelationshipRequest

 * Describe
 * This class represents the transaction when someone requests an other person to be friends or foes.


 * Function
 * By having such a class, we should be able to create a request like so:

new RelationshipRequest( $from, $to, $type )->createRequest;

Special pages
All special pages in UserRelationship will become a wrapper around these objects.


 * SpecialViewRelationships
 * Will call RelationshipLookup on current relationships


 * SpecialViewRelationshipRequests
 * Will call RelationshipRequestQueueLookup on current open relationship requests


 * SpecialAddRelationship
 * For the future, will allow direct access for searching up a user and sending a RelationshipRequest


 * SpecialRemoveRelationship
 * For the future, will allow direct access for going through current users and removing them

Migration map of functions
Map of functions for their migration path.


 * Relationship
 * to
 * to
 * RelationshipEmail
 * moved here with same name
 * moved here with same name
 * moved here with same name
 * RelationshipLookup
 * to
 * to
 * to
 * to
 * RelationshipRequest
 * to
 * RelationshipRequestStatus
 * to
 * to
 * to
 * RelationshipRequestQueueCount
 * to
 * to
 * to  (now private)
 * to  (now private)
 * to
 * RelationshipRequestQueueLookup
 * to
 * to
 * moved here with same name