|
|
@@ -411,7 +411,11 @@ class UsersController extends \lithium\action\Controller {
|
|
|
return compact('user');
|
|
|
}
|
|
|
|
|
|
- public function requestFriend($username) {
|
|
|
+ public function requestFriend($username = null) {
|
|
|
+ if ($username == null)
|
|
|
+ {
|
|
|
+ $username = $this->request->query['username'];
|
|
|
+ }
|
|
|
//If the user isn't blocking this user,
|
|
|
|
|
|
//And the user doesn't have private set
|
|
|
@@ -419,10 +423,14 @@ class UsersController extends \lithium\action\Controller {
|
|
|
//Send them a DM with a confirm key
|
|
|
$key = confirmKey::create();
|
|
|
$thisUser = auth::check('default');
|
|
|
- $link = Html::link('here', "/users/confirmFriend/$this->username/$key->key");
|
|
|
- $post = Post::create(array('body' => "$thisUser->username want's to be your friend. Click $link to confirm"));
|
|
|
+ $url = \lithium\net\http\Router::match(array('controller' => 'users',
|
|
|
+ 'action' => 'confirmFriend',
|
|
|
+ 'args'=>array($thisUser['username'], $key->key)), null, array('absolute' => 'false'));
|
|
|
+ $post = Post::create(array('body' => $thisUser['username'] . " want's to be your friend. Click $url to confirm"));
|
|
|
+
|
|
|
+ $post->directMessage($thisUser);
|
|
|
|
|
|
- $post->directMessage($username);
|
|
|
+ return $this->redirect('users::feed');
|
|
|
|
|
|
}
|
|
|
|