2
2
3
3
namespace humhub \modules \mail \models \forms ;
4
4
5
+ use humhub \modules \mail \helpers \Url ;
5
6
use humhub \modules \mail \models \Message ;
6
7
use humhub \modules \mail \models \MessageNotification ;
7
8
use humhub \modules \mail \models \UserMessage ;
9
+ use humhub \modules \mail \permissions \SendMail ;
10
+ use humhub \modules \user \models \User ;
8
11
use Yii ;
9
12
use yii \base \Model ;
10
- use humhub \modules \user \models \User ;
11
- use humhub \modules \mail \permissions \SendMail ;
12
13
use yii \helpers \Html ;
13
- use humhub \modules \mail \helpers \Url ;
14
14
15
15
/**
16
16
* @package humhub.modules.mail.forms
@@ -72,9 +72,9 @@ public function checkRecipient($attribute, $params)
72
72
$ name = Html::encode ($ user ->getDisplayName ());
73
73
if (Yii::$ app ->user ->identity ->is ($ user )) {
74
74
$ this ->addError ($ attribute , Yii::t ('MailModule.forms_InviteRecipientForm ' , "You cannot send a email to yourself! " ));
75
- } else if ($ this ->message ->isParticipant ($ user )) {
75
+ } else if ($ this ->message ->isParticipant ($ user )) {
76
76
$ this ->addError ($ attribute , Yii::t ('MailModule.forms_InviteRecipientForm ' , "User {name} is already participating! " , ['name ' => $ name ]));
77
- } else if (!$ user ->can (SendMail::class) && !Yii::$ app ->user ->isAdmin ()){
77
+ } else if (!$ user ->can (SendMail::class) && !Yii::$ app ->user ->isAdmin ()) {
78
78
$ this ->addError ($ attribute , Yii::t ('MailModule.forms_InviteRecipientForm ' , "You are not allowed to send user {name} is already! " , ['name ' => $ name ]));
79
79
} else {
80
80
$ this ->recipientUsers [] = $ user ;
@@ -95,7 +95,7 @@ public function getUrl()
95
95
96
96
public function save ()
97
97
{
98
- if (!$ this ->validate ()) {
98
+ if (!$ this ->validate ()) {
99
99
return false ;
100
100
}
101
101
@@ -106,7 +106,7 @@ public function save()
106
106
'is_originator ' => 0
107
107
]);
108
108
109
- if ($ userMessage ->save ()) {
109
+ if ($ userMessage ->save ()) {
110
110
(new MessageNotification ($ this ->message ))->notify ($ user );
111
111
}
112
112
}
0 commit comments