mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Don't send "Follows" notification on request friendship (#5526)
* Don't send "Follows" notification on request friendship * Fixed tests * Fixed tests * Fixed tests, reduce count without following emails Co-authored-by: Lucas Bartholemy <lucas@bartholemy.com>
This commit is contained in:
parent
5a239af7d9
commit
6e831f5428
@ -5,6 +5,7 @@ HumHub Changelog
|
||||
-------------------
|
||||
- Fix #5480: `el` language file in Admin section broken
|
||||
- Fix #5479: Fix ContentContainerPermissionAccess without provided container
|
||||
- Fix #5517: Don't send "Follows" notification on request friendship
|
||||
|
||||
|
||||
1.10.3 (December 20, 2021)
|
||||
|
@ -27,7 +27,7 @@ class FriendshipTest extends HumHubDbTestCase
|
||||
|
||||
// Request Friendship
|
||||
$this->assertTrue(Friendship::add(Yii::$app->user->getIdentity(), $friendUser));
|
||||
$this->assertMailSent(2, 'Friendship request mail sent.');
|
||||
$this->assertMailSent(1, 'Friendship request mail sent.');
|
||||
|
||||
$fiendship = Friendship::findOne(['user_id' => Yii::$app->user->id, 'friend_user_id' => 2]);
|
||||
$this->assertNotNull($fiendship, 'Friendship model persisted.');
|
||||
@ -37,7 +37,7 @@ class FriendshipTest extends HumHubDbTestCase
|
||||
// Accept friendship
|
||||
$this->assertTrue(Friendship::add($friendUser, Yii::$app->user->getIdentity()));
|
||||
$this->assertEquals(Friendship::getStateForUser($friendUser, Yii::$app->user->getIdentity()), Friendship::STATE_FRIENDS, 'Check Friend Status');
|
||||
$this->assertMailSent(4, 'Friendship acknowledged mail sent.');
|
||||
$this->assertMailSent(2, 'Friendship acknowledged mail sent.');
|
||||
}
|
||||
|
||||
public function testDeclineFriendShip()
|
||||
@ -51,7 +51,7 @@ class FriendshipTest extends HumHubDbTestCase
|
||||
|
||||
// Request Friendship
|
||||
$this->assertTrue(Friendship::add(Yii::$app->user->getIdentity(), $friendUser));
|
||||
$this->assertMailSent(2, 'Friendship request mail sent.');
|
||||
$this->assertMailSent(1, 'Friendship request mail sent.');
|
||||
|
||||
$fiendship = Friendship::findOne(['user_id' => Yii::$app->user->id, 'friend_user_id' => 2]);
|
||||
$this->assertNotNull($fiendship, 'Friendship model persisted.');
|
||||
@ -61,6 +61,6 @@ class FriendshipTest extends HumHubDbTestCase
|
||||
// Cancel request
|
||||
Friendship::cancel($friendUser, Yii::$app->user->getIdentity());
|
||||
$this->assertEquals(Friendship::getStateForUser($friendUser, Yii::$app->user->getIdentity()), Friendship::STATE_NONE, 'Check Friend Status');
|
||||
$this->assertMailSent(3, 'Friendship acknowledged mail sent.');
|
||||
$this->assertMailSent(2, 'Friendship acknowledged mail sent.');
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ class ProfileController extends ContentContainerController
|
||||
}
|
||||
|
||||
$this->forcePostRequest();
|
||||
$this->getUser()->follow(Yii::$app->user->getIdentity(), false);
|
||||
$this->getUser()->follow(Yii::$app->user->getIdentity());
|
||||
|
||||
if (Yii::$app->request->isAjax) {
|
||||
Yii::$app->response->format = 'json';
|
||||
|
@ -96,7 +96,7 @@ class Follow extends ActiveRecord
|
||||
*/
|
||||
public function afterSave($insert, $changedAttributes)
|
||||
{
|
||||
if ($insert && $this->object_model == User::class) {
|
||||
if ($insert && $this->send_notifications && $this->object_model == User::class) {
|
||||
Followed::instance()
|
||||
->from($this->user)
|
||||
->about($this)
|
||||
|
Loading…
x
Reference in New Issue
Block a user