diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml
new file mode 100644
index 00000000..2144827b
--- /dev/null
+++ b/.github/workflows/php-cs-fixer.yml
@@ -0,0 +1,7 @@
+name: PHP CS Fixer
+
+on: push
+
+jobs:
+ tests:
+ uses: humhub/actions/.github/workflows/module-php-cs-fixer.yml@main
diff --git a/Module.php b/Module.php
index d3a0a1ed..fa1e3478 100644
--- a/Module.php
+++ b/Module.php
@@ -20,7 +20,6 @@
*/
class Module extends \humhub\components\Module
{
-
/**
* @inheritdoc
*/
@@ -82,11 +81,11 @@ public function getPermissions($contentContainer = null)
{
if (!$contentContainer) {
return [
- new StartConversation()
+ new StartConversation(),
];
- } else if ($contentContainer instanceof User) {
+ } elseif ($contentContainer instanceof User) {
return [
- new SendMail()
+ new SendMail(),
];
}
@@ -97,14 +96,14 @@ public function getNotifications()
{
return [
MailNotification::class,
- ConversationNotification::class
+ ConversationNotification::class,
];
}
/**
* Determines showInTopNav is enabled or not
*
- * @return boolean is showInTopNav enabled
+ * @return bool is showInTopNav enabled
*/
public function hideInTopNav()
{
diff --git a/assets/MailMessengerAsset.php b/assets/MailMessengerAsset.php
index a7efeea1..5b10b9be 100644
--- a/assets/MailMessengerAsset.php
+++ b/assets/MailMessengerAsset.php
@@ -17,6 +17,6 @@ class MailMessengerAsset extends AssetBundle
];
public $depends = [
- MailNotificationAsset::class
+ MailNotificationAsset::class,
];
}
diff --git a/assets/MailNotificationAsset.php b/assets/MailNotificationAsset.php
index bc251ddb..f97791da 100644
--- a/assets/MailNotificationAsset.php
+++ b/assets/MailNotificationAsset.php
@@ -24,7 +24,7 @@ class MailNotificationAsset extends AssetBundle
];
public $depends = [
- MailStyleAsset::class
+ MailStyleAsset::class,
];
public static function register($view)
@@ -34,10 +34,10 @@ public static function register($view)
'url' => [
'count' => Url::toMessageCountUpdate(),
'list' => Url::toNotificationList(),
- ]
- ]
+ ],
+ ],
]);
return parent::register($view);
}
-}
\ No newline at end of file
+}
diff --git a/assets/MailStyleAsset.php b/assets/MailStyleAsset.php
index d74ebc14..dddf8488 100644
--- a/assets/MailStyleAsset.php
+++ b/assets/MailStyleAsset.php
@@ -19,6 +19,6 @@ class MailStyleAsset extends AssetBundle
];
public $css = [
- 'humhub.mail.min.css'
+ 'humhub.mail.min.css',
];
-}
\ No newline at end of file
+}
diff --git a/controllers/ConfigController.php b/controllers/ConfigController.php
index ffccc09c..64b34cd2 100644
--- a/controllers/ConfigController.php
+++ b/controllers/ConfigController.php
@@ -20,7 +20,6 @@
*/
class ConfigController extends \humhub\modules\admin\components\Controller
{
-
/**
* Configuration action for super admins.
*/
@@ -35,5 +34,3 @@ public function actionIndex()
return $this->render('index', ['model' => $form]);
}
}
-
-?>
diff --git a/controllers/InboxController.php b/controllers/InboxController.php
index c5925f8c..58b6ef38 100644
--- a/controllers/InboxController.php
+++ b/controllers/InboxController.php
@@ -17,14 +17,13 @@
*/
class InboxController extends Controller
{
-
/**
* @inheritdoc
*/
protected function getAccessRules()
{
return [
- [ControllerAccess::RULE_LOGGED_IN_ONLY]
+ [ControllerAccess::RULE_LOGGED_IN_ONLY],
];
}
@@ -37,7 +36,7 @@ protected function getAccessRules()
public function actionIndex()
{
return ConversationInbox::widget([
- 'filter' => new InboxFilterForm()
+ 'filter' => new InboxFilterForm(),
]);
}
@@ -57,7 +56,7 @@ public function actionLoadMore()
return $this->asJson([
'result' => $result,
- 'isLast' => $filter->wasLastPage()
+ 'isLast' => $filter->wasLastPage(),
]);
}
diff --git a/controllers/MailController.php b/controllers/MailController.php
index 9962b6ba..7a5f0ec1 100644
--- a/controllers/MailController.php
+++ b/controllers/MailController.php
@@ -36,7 +36,6 @@
*/
class MailController extends Controller
{
-
/**
* @inheritdoc
*/
@@ -51,7 +50,7 @@ protected function getAccessRules()
{
return [
[ControllerAccess::RULE_LOGGED_IN_ONLY],
- [ControllerAccess::RULE_PERMISSION => StartConversation::class, 'actions' => ['create', 'add-user']]
+ [ControllerAccess::RULE_PERMISSION => StartConversation::class, 'actions' => ['create', 'add-user']],
];
}
@@ -98,7 +97,7 @@ public function actionSeen()
}
return $this->asJson([
- 'messageCount' => UserMessage::getNewMessageCount()
+ 'messageCount' => UserMessage::getNewMessageCount(),
]);
}
@@ -111,7 +110,7 @@ public function actionUpdate($id, $from = null)
return $this->renderAjaxContent(Messages::widget([
'message' => $message,
'entries' => $message->getEntryUpdates($from)->all(),
- 'showDateBadge' => false
+ 'showDateBadge' => false,
]));
}
@@ -127,7 +126,7 @@ public function actionLoadMore($id, $from)
return $this->asJson([
'result' => $result,
- 'isLast' => (count($entries) < Module::getModuleInstance()->conversationUpdatePageSize)
+ 'isLast' => (count($entries) < Module::getModuleInstance()->conversationUpdatePageSize),
]);
}
@@ -142,15 +141,15 @@ public function actionReply($id)
if ($replyForm->load(Yii::$app->request->post()) && $replyForm->save()) {
return $this->asJson([
'success' => true,
- 'content' => ConversationEntry::widget(['entry' => $replyForm->reply, 'showDateBadge' => $replyForm->reply->isFirstToday()])
+ 'content' => ConversationEntry::widget(['entry' => $replyForm->reply, 'showDateBadge' => $replyForm->reply->isFirstToday()]),
]);
}
return $this->asJson([
'success' => false,
'error' => [
- 'message' => $replyForm->getFirstError('message')
- ]
+ 'message' => $replyForm->getFirstError('message'),
+ ],
]);
}
@@ -163,7 +162,7 @@ public function actionUserList($id)
{
return $this->renderAjaxContent(UserListBox::widget([
'query' => $this->getMessage($id, true)->getUsers(),
- 'title' => '' . Yii::t('MailModule.base', 'Participants') . ''
+ 'title' => '' . Yii::t('MailModule.base', 'Participants') . '',
]));
}
@@ -184,15 +183,15 @@ public function actionAddUser($id)
if ($inviteForm->load(Yii::$app->request->post())) {
if ($inviteForm->save()) {
return $this->asJson([
- 'result' => ConversationHeader::widget(['message' => $message])
+ 'result' => ConversationHeader::widget(['message' => $message]),
]);
}
return $this->asJson([
'success' => false,
'error' => [
- 'message' => $inviteForm->getFirstError('recipients')
- ]
+ 'message' => $inviteForm->getFirstError('recipients'),
+ ],
]);
}
@@ -232,7 +231,7 @@ public function actionSearchUser($keyword, $id = null)
'keyword' => $keyword,
'permission' => (!Yii::$app->user->isAdmin()) ? new SendMail() : null,
'disableFillUser' => true,
- 'disabledText' => Yii::t('MailModule.base', 'You are not allowed to start a conversation with this user.')
+ 'disabledText' => Yii::t('MailModule.base', 'You are not allowed to start a conversation with this user.'),
]);
// Disable already participating users
@@ -266,7 +265,7 @@ private function checkMessagePermissions($message)
*
* @param type $message
* @param type $user
- * @return boolean
+ * @return bool
*/
private function isParticipant($message, $user)
{
@@ -355,7 +354,7 @@ public function actionMarkUnread($id)
return $this->asJson([
'success' => true,
- 'redirect' => $nextReadMessage ? Url::toMessenger($nextReadMessage) : Url::to(['/dashboard'])
+ 'redirect' => $nextReadMessage ? Url::toMessenger($nextReadMessage) : Url::to(['/dashboard']),
]);
}
@@ -372,7 +371,7 @@ public function actionPin($id)
return $this->asJson([
'success' => true,
- 'redirect' => Url::toMessenger($message)
+ 'redirect' => Url::toMessenger($message),
]);
}
@@ -389,7 +388,7 @@ public function actionUnpin($id)
return $this->asJson([
'success' => true,
- 'redirect' => Url::toMessenger($message)
+ 'redirect' => Url::toMessenger($message),
]);
}
@@ -411,7 +410,7 @@ public function actionLeave($id)
return $this->asJson([
'success' => true,
- 'redirect' => Url::toMessenger()
+ 'redirect' => Url::toMessenger(),
]);
}
@@ -439,8 +438,8 @@ public function actionEditEntry($id)
'success' => true,
'content' => ConversationEntry::widget([
'entry' => $entry,
- 'showDateBadge' => false
- ])
+ 'showDateBadge' => false,
+ ]),
]);
}
@@ -472,7 +471,7 @@ public function actionDeleteEntry($id)
$entry->message->deleteEntry($entry);
return $this->asJson([
- 'success' => true
+ 'success' => true,
]);
}
@@ -520,7 +519,7 @@ private function getNextReadMessage($id): ?Message
->andWhere('user_message.last_viewed >= message.updated_at')
->orderBy([
'user_message.pinned' => SORT_DESC,
- 'message.updated_at' => SORT_DESC
+ 'message.updated_at' => SORT_DESC,
])
->one();
}
diff --git a/controllers/TagController.php b/controllers/TagController.php
index 0ce9718b..c1deee55 100644
--- a/controllers/TagController.php
+++ b/controllers/TagController.php
@@ -30,7 +30,7 @@ class TagController extends Controller
protected function getAccessRules()
{
return [
- [ControllerAccess::RULE_LOGGED_IN_ONLY]
+ [ControllerAccess::RULE_LOGGED_IN_ONLY],
];
}
@@ -117,7 +117,7 @@ public function actionEditConversation($messageId)
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return ModalClose::widget([
- 'script' => '$("#' . ConversationTags::ID . '").replaceWith(\'' . ConversationTags::widget(['message' => $message]) . '\');'
+ 'script' => '$("#' . ConversationTags::ID . '").replaceWith(\'' . ConversationTags::widget(['message' => $message]) . '\');',
]);
}
diff --git a/controllers/rest/EntryController.php b/controllers/rest/EntryController.php
index 334b27d0..fac9a3a8 100644
--- a/controllers/rest/EntryController.php
+++ b/controllers/rest/EntryController.php
@@ -14,13 +14,11 @@
use Yii;
use yii\web\HttpException;
-
/**
* Class EntryController
*/
class EntryController extends BaseController
{
-
/**
* Get all entries of the conversation
*
@@ -151,7 +149,7 @@ protected function getMessageEntry($messageId, $entryId)
$entry = MessageEntry::findOne([
'id' => $entryId,
- 'message_id' => $message->id
+ 'message_id' => $message->id,
]);
if (!$entry) {
@@ -160,4 +158,4 @@ protected function getMessageEntry($messageId, $entryId)
return $entry;
}
-}
\ No newline at end of file
+}
diff --git a/controllers/rest/MessageController.php b/controllers/rest/MessageController.php
index 4f99500f..aa7ada44 100644
--- a/controllers/rest/MessageController.php
+++ b/controllers/rest/MessageController.php
@@ -16,13 +16,11 @@
use yii\web\ForbiddenHttpException;
use yii\web\HttpException;
-
/**
* Class MessageController
*/
class MessageController extends BaseController
{
-
/**
* Get list of mail conversations
*
@@ -102,4 +100,4 @@ public static function getMessage($id)
return $message;
}
-}
\ No newline at end of file
+}
diff --git a/controllers/rest/TagController.php b/controllers/rest/TagController.php
index 7dc47a06..d16b3af3 100644
--- a/controllers/rest/TagController.php
+++ b/controllers/rest/TagController.php
@@ -15,13 +15,11 @@
use Yii;
use yii\web\HttpException;
-
/**
* Class TagController
*/
class TagController extends BaseController
{
-
/**
* Get all tags of the conversation
*
@@ -86,4 +84,4 @@ public function actionUpdate($messageId)
Yii::error('Could not create validated entry for the conversation.', 'api');
return $this->returnError(500, 'Internal error while update tags of the conversation!');
}
-}
\ No newline at end of file
+}
diff --git a/controllers/rest/UserController.php b/controllers/rest/UserController.php
index eef8e6de..44c5a1f1 100644
--- a/controllers/rest/UserController.php
+++ b/controllers/rest/UserController.php
@@ -13,13 +13,11 @@
use Yii;
use yii\web\HttpException;
-
/**
* Class UserController
*/
class UserController extends BaseController
{
-
/**
* Get all participants of the conversation
*
@@ -95,4 +93,4 @@ protected function getUser($id)
}
return $user;
}
-}
\ No newline at end of file
+}
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 85f400f6..36f45eb2 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -6,6 +6,7 @@ Changelog
- Enh #382: Implement provider for meta searching
- Fix #389: Fix notification about participant joining
- Fix #396: Don't override global styles
+- Enh #397: Use PHP CS Fixer
3.2.1 (April 15, 2024)
----------------------
diff --git a/helpers/RestDefinitions.php b/helpers/RestDefinitions.php
index aa12f192..0028c329 100644
--- a/helpers/RestDefinitions.php
+++ b/helpers/RestDefinitions.php
@@ -12,13 +12,11 @@
use humhub\modules\mail\models\MessageTag;
use humhub\modules\rest\definitions\UserDefinitions;
-
/**
* Class RestDefinitions
*/
class RestDefinitions
{
-
public static function getMessage(Message $message)
{
return [
@@ -64,4 +62,3 @@ public static function getMessageTag(MessageTag $tag)
];
}
}
-
diff --git a/helpers/Url.php b/helpers/Url.php
index c7e2fdd9..0e0ef9db 100644
--- a/helpers/Url.php
+++ b/helpers/Url.php
@@ -7,7 +7,7 @@
class Url extends \yii\helpers\Url
{
- const ROUTE_SEARCH_TAG = '/mail/tag/search';
+ public const ROUTE_SEARCH_TAG = '/mail/tag/search';
public static function toCreateConversation($userGuid = null)
{
@@ -32,7 +32,7 @@ public static function toUpdateMessage()
public static function toEditMessageEntry(MessageEntry $entry)
{
- return static::to( ['/mail/mail/edit-entry', 'id' => $entry->id]);
+ return static::to(['/mail/mail/edit-entry', 'id' => $entry->id]);
}
public static function toEditConversationTags(Message $message)
diff --git a/live/NewUserMessage.php b/live/NewUserMessage.php
index f7dce7e4..75d70000 100644
--- a/live/NewUserMessage.php
+++ b/live/NewUserMessage.php
@@ -30,9 +30,9 @@ class NewUserMessage extends LiveEvent
* @var int the id of the new notification
*/
public $user_guid;
-
+
/**
- * @var string text representation used for frotnend desktop notifications
+ * @var string text representation used for frotnend desktop notifications
*/
public $message_id;
diff --git a/migrations/m131023_165507_initial.php b/migrations/m131023_165507_initial.php
index 8d32243b..aab23472 100644
--- a/migrations/m131023_165507_initial.php
+++ b/migrations/m131023_165507_initial.php
@@ -4,7 +4,6 @@
class m131023_165507_initial extends Migration
{
-
public function up()
{
diff --git a/migrations/m150429_190600_indexes.php b/migrations/m150429_190600_indexes.php
index e7569a1b..6030d32b 100644
--- a/migrations/m150429_190600_indexes.php
+++ b/migrations/m150429_190600_indexes.php
@@ -4,7 +4,6 @@
class m150429_190600_indexes extends Migration
{
-
public function up()
{
$this->createIndex('index_user_id', 'message_entry', 'user_id', false);
diff --git a/migrations/m150709_050451_namespace.php b/migrations/m150709_050451_namespace.php
index 88b9c7f8..f49a3d21 100644
--- a/migrations/m150709_050451_namespace.php
+++ b/migrations/m150709_050451_namespace.php
@@ -6,7 +6,6 @@
class m150709_050451_namespace extends Migration
{
-
public function up()
{
$this->renameClass('MessageEntry', MessageEntry::className());
diff --git a/migrations/m150709_050452_message_tags.php b/migrations/m150709_050452_message_tags.php
index 994b300c..5a69f6b8 100644
--- a/migrations/m150709_050452_message_tags.php
+++ b/migrations/m150709_050452_message_tags.php
@@ -6,7 +6,6 @@
class m150709_050452_message_tags extends Migration
{
-
public function safeUp()
{
$this->createTable('message_tag', [
@@ -14,7 +13,7 @@ public function safeUp()
'user_id' => $this->integer()->notNull(),
'name' => $this->string(100)->notNull(),
'sort_order' => $this->integer(11)->defaultValue(0),
- 'color' => $this->string(7)->null()
+ 'color' => $this->string(7)->null(),
]);
try {
diff --git a/migrations/m150709_050453_conversation_tags.php b/migrations/m150709_050453_conversation_tags.php
index c2bbcf84..5bb231e5 100644
--- a/migrations/m150709_050453_conversation_tags.php
+++ b/migrations/m150709_050453_conversation_tags.php
@@ -6,7 +6,6 @@
class m150709_050453_conversation_tags extends Migration
{
-
public function safeUp()
{
diff --git a/migrations/m230213_094842_add_entry_type.php b/migrations/m230213_094842_add_entry_type.php
index f49313cf..71532ae0 100644
--- a/migrations/m230213_094842_add_entry_type.php
+++ b/migrations/m230213_094842_add_entry_type.php
@@ -14,11 +14,14 @@ class m230213_094842_add_entry_type extends Migration
*/
public function safeUp()
{
- $this->safeAddColumn(AbstractMessageEntry::tableName(), 'type', $this->tinyInteger()
+ $this->safeAddColumn(
+ AbstractMessageEntry::tableName(),
+ 'type',
+ $this->tinyInteger()
->defaultValue(MessageEntry::type())
->notNull()
->unsigned()
- ->after('content')
+ ->after('content'),
);
$this->alterColumn(AbstractMessageEntry::tableName(), 'content', $this->text()->null());
}
diff --git a/migrations/m230214_062338_drop_file_id.php b/migrations/m230214_062338_drop_file_id.php
index ad437f04..6722a029 100644
--- a/migrations/m230214_062338_drop_file_id.php
+++ b/migrations/m230214_062338_drop_file_id.php
@@ -3,7 +3,6 @@
use humhub\components\Migration;
use humhub\modules\mail\models\MessageEntry;
-
/**
* Class m230214_062338_drop_file_id
*/
diff --git a/migrations/uninstall.php b/migrations/uninstall.php
index f742f5ba..e3c26d04 100644
--- a/migrations/uninstall.php
+++ b/migrations/uninstall.php
@@ -4,7 +4,6 @@
class uninstall extends Migration
{
-
public function up()
{
$this->safeDropTable('user_message_tag');
diff --git a/models/AbstractMessageEntry.php b/models/AbstractMessageEntry.php
index 5bea4b3e..c147a54b 100644
--- a/models/AbstractMessageEntry.php
+++ b/models/AbstractMessageEntry.php
@@ -18,15 +18,15 @@
* This class represents abstract class for normal message and state entries within a conversation.
*
* The followings are the available columns in table 'message_entry':
- * @property integer $id
- * @property integer $message_id
- * @property integer $user_id
+ * @property int $id
+ * @property int $message_id
+ * @property int $user_id
* @property string $content
- * @property integer $type
+ * @property int $type
* @property string $created_at
- * @property integer $created_by
+ * @property int $created_by
* @property string $updated_at
- * @property integer $updated_by
+ * @property int $updated_by
*
* The followings are the available model relations:
* @property Message $message
@@ -37,9 +37,9 @@
*/
abstract class AbstractMessageEntry extends ActiveRecord
{
- const TYPE_MESSAGE = 0;
- const TYPE_USER_JOINED = 1;
- const TYPE_USER_LEFT = 2;
+ public const TYPE_MESSAGE = 0;
+ public const TYPE_USER_JOINED = 1;
+ public const TYPE_USER_LEFT = 2;
protected bool $requiredContent = true;
@@ -150,7 +150,7 @@ public function afterDelete()
'contentContainerId' => $user->contentcontainer_id,
'message_id' => $this->message_id,
'entry_id' => $this->id,
- 'user_id' => $user->id
+ 'user_id' => $user->id,
]));
}
}
diff --git a/models/Config.php b/models/Config.php
index 9486fc71..1f698a1e 100644
--- a/models/Config.php
+++ b/models/Config.php
@@ -16,7 +16,6 @@
*/
class Config extends \yii\base\Model
{
-
public $showInTopNav;
public $newUserRestrictionEnabled = 0;
@@ -63,7 +62,7 @@ public function rules()
'newUserMessageRestriction',
'userConversationRestriction',
'userMessageRestriction'], 'integer', 'min' => 0],
- ['newUserSinceDays', 'integer', 'min' => 1]
+ ['newUserSinceDays', 'integer', 'min' => 1],
];
}
@@ -81,7 +80,7 @@ public function attributeLabels()
'newUserConversationRestriction' => Yii::t('MailModule.base', 'Max number of new conversations allowed for a new user per day'),
'newUserMessageRestriction' => Yii::t('MailModule.base', 'Max number of messages allowed for a new user per day'),
'userConversationRestriction' => Yii::t('MailModule.base', 'Max number of new conversations allowed for a user per day'),
- 'userMessageRestriction' => Yii::t('MailModule.base', 'Max messages allowed per day')
+ 'userMessageRestriction' => Yii::t('MailModule.base', 'Max messages allowed per day'),
];
}
@@ -121,7 +120,7 @@ public function isNewUser(User $originator)
return false;
}
- return (new DateTime($originator->created_at))->diff(new DateTime())->days < $this->newUserSinceDays;
+ return (new DateTime($originator->created_at))->diff(new DateTime())->days < $this->newUserSinceDays;
}
public function getConversationCount($originator)
@@ -136,7 +135,7 @@ public function getConversationCount($originator)
}
$lastDate = (new \DateTime())->setTimestamp($lastTS);
- $today = (new \DateTime())->setTime(0,0,0);
+ $today = (new \DateTime())->setTime(0, 0, 0);
if($today > $lastDate) {
$module->settings->contentContainer($originator)->set('conversationCountTime', time());
@@ -144,7 +143,7 @@ public function getConversationCount($originator)
return 0;
}
- return (integer) static::getModule()->settings->contentContainer($originator)->get('conversationCount', 0);
+ return (int) static::getModule()->settings->contentContainer($originator)->get('conversationCount', 0);
}
public function reset($originator)
diff --git a/models/Message.php b/models/Message.php
index 09ebf63d..44242ebf 100644
--- a/models/Message.php
+++ b/models/Message.php
@@ -2,7 +2,6 @@
namespace humhub\modules\mail\models;
-
use humhub\components\ActiveRecord;
use humhub\modules\mail\Module;
use humhub\modules\ui\icon\widgets\Icon;
@@ -14,12 +13,12 @@
* This class represents a single conversation.
*
* The followings are the available columns in table 'message':
- * @property integer $id
+ * @property int $id
* @property string $title
* @property string $created_at
- * @property integer $created_by
+ * @property int $created_by
* @property string $updated_at
- * @property integer $updated_by
+ * @property int $updated_by
* @property-read User $originator
* @property-read MessageEntry $lastEntry
*
@@ -120,7 +119,7 @@ public function getUserMessage($userId = null)
return UserMessage::findOne([
'user_id' => $userId,
- 'message_id' => $this->id
+ 'message_id' => $this->id,
]);
}
@@ -309,7 +308,7 @@ public function seen($userId)
// Update User Message Entry
$userMessage = UserMessage::findOne(array(
'user_id' => $userId,
- 'message_id' => $this->id
+ 'message_id' => $this->id,
));
if ($userMessage !== null) {
$userMessage->last_viewed = date('Y-m-d G:i:s');
@@ -344,7 +343,7 @@ public function addRecepient(User $recipient, bool $originator = false, bool $in
$userMessage = new UserMessage([
'message_id' => $this->id,
'user_id' => $recipient->id,
- 'informAfterAdd' => $informAfterAdd
+ 'informAfterAdd' => $informAfterAdd,
]);
if ($originator) {
diff --git a/models/MessageTag.php b/models/MessageTag.php
index 5a3b556e..2a25680f 100644
--- a/models/MessageTag.php
+++ b/models/MessageTag.php
@@ -1,9 +1,7 @@
['user_id', 'name'], 'when' => function(MessageTag $model) {
+ ['name', 'unique', 'targetAttribute' => ['user_id', 'name'], 'when' => function (MessageTag $model) {
return $model->isNewRecord || $model->isAttributeChanged('name');
- }, 'message' => Yii::t('MailModule.base', 'A tag with the same name already exists.')]
+ }, 'message' => Yii::t('MailModule.base', 'A tag with the same name already exists.')],
];
}
@@ -60,7 +58,7 @@ public static function search($userId, $keyword)
*/
public static function attach($userId, Message $message, $tags = [])
{
- /* @var $result static[] */
+ /* @var $result static[] */
$result = [];
$userMessage = $message->getUserMessage();
@@ -82,7 +80,7 @@ public static function attach($userId, Message $message, $tags = [])
if(is_string($tag) && strpos($tag, '_add:') === 0) {
$newTag = new static([
'name' => substr($tag, strlen('_add:')),
- 'user_id' => $userId
+ 'user_id' => $userId,
]);
if ($newTag->save()) {
@@ -103,8 +101,7 @@ public static function attach($userId, Message $message, $tags = [])
private static function deleteTagRelations($userId, UserMessage $message)
{
- foreach (UserMessageTag::findAllByUserMessage($message)->all() as $userMessageTag)
- {
+ foreach (UserMessageTag::findAllByUserMessage($message)->all() as $userMessageTag) {
$userMessageTag->delete();
}
}
@@ -123,7 +120,7 @@ public function afterDelete()
private static function addTagsToConversation(UserMessage $message, array $userTags)
{
foreach ($userTags as $userTag) {
- UserMessageTag::create($message, $userTag);
+ UserMessageTag::create($message, $userTag);
}
}
@@ -148,4 +145,4 @@ public static function findByUser(int $userId)
{
return static::find()->where(['user_id' => $userId])->orderBy('name');
}
-}
\ No newline at end of file
+}
diff --git a/models/UserMessage.php b/models/UserMessage.php
index 9336f67c..29a13719 100644
--- a/models/UserMessage.php
+++ b/models/UserMessage.php
@@ -14,15 +14,15 @@
* This is the model class for table "user_message".
*
* The followings are the available columns in table 'user_message':
- * @property integer $message_id
- * @property integer $user_id
- * @property integer $is_originator
+ * @property int $message_id
+ * @property int $user_id
+ * @property int $is_originator
* @property string $last_viewed
* @property string $created_at
- * @property integer $created_by
+ * @property int $created_by
* @property string $updated_at
- * @property integer $updated_by
- * @property integer $pinned
+ * @property int $updated_by
+ * @property int $pinned
*
* @property-read Message $message
* @property-read User $user
@@ -116,7 +116,7 @@ public static function findByUser($userId = null)
->where(['user_message.user_id' => $userId])
->orderBy([
'user_message.pinned' => SORT_DESC,
- 'message.updated_at' => SORT_DESC
+ 'message.updated_at' => SORT_DESC,
]);
}
diff --git a/models/UserMessageTag.php b/models/UserMessageTag.php
index 7a77454f..414935cb 100644
--- a/models/UserMessageTag.php
+++ b/models/UserMessageTag.php
@@ -1,9 +1,7 @@
['message_id', 'user_id', 'tag_id']]
+ ['message_id', 'unique', 'targetAttribute' => ['message_id', 'user_id', 'tag_id']],
];
}
@@ -48,7 +46,7 @@ public static function create(UserMessage $message, MessageTag $userTag)
*/
public function getUser()
{
- return $this->hasOne(User::class,['id' => 'user_id']);
+ return $this->hasOne(User::class, ['id' => 'user_id']);
}
/**
@@ -56,7 +54,7 @@ public function getUser()
*/
public function getTag()
{
- return $this->hasOne(MessageTag::class,['id' => 'tag_id']);
+ return $this->hasOne(MessageTag::class, ['id' => 'tag_id']);
}
/**
@@ -70,4 +68,4 @@ public static function findAllByUserMessage(UserMessage $message)
->where(['message_id' => $message->message_id])
->andWhere(['user_id' => $message->user_id]);
}
-}
\ No newline at end of file
+}
diff --git a/models/forms/AddTag.php b/models/forms/AddTag.php
index b155eaf8..e78ca97f 100644
--- a/models/forms/AddTag.php
+++ b/models/forms/AddTag.php
@@ -1,9 +1,7 @@
tag->save();
}
-}
\ No newline at end of file
+}
diff --git a/models/forms/ConversationTagsForm.php b/models/forms/ConversationTagsForm.php
index 41e8d2b7..7491a8df 100644
--- a/models/forms/ConversationTagsForm.php
+++ b/models/forms/ConversationTagsForm.php
@@ -1,9 +1,7 @@
isCurrentUser()) {
$this->addError($attribute, Yii::t('MailModule.base', 'You cannot send a message to yourself!'));
- } else if (!$this->canSendToUser($user)) {
+ } elseif (!$this->canSendToUser($user)) {
$this->addError($attribute, Yii::t('MailModule.base', 'You are not allowed to start a conversation with {userName}!', [
- 'userName' => Html::encode($user->getDisplayName())
+ 'userName' => Html::encode($user->getDisplayName()),
]));
} else {
$this->recipients[] = $user;
@@ -187,7 +186,7 @@ private function saveRecipients()
private function saveMessage()
{
$this->messageInstance = new Message([
- 'title' => $this->title
+ 'title' => $this->title,
]);
if (!(new Config())->canCreateConversation(Yii::$app->user->getIdentity())) {
diff --git a/models/forms/ReplyForm.php b/models/forms/ReplyForm.php
index b95bd25f..e21546dd 100644
--- a/models/forms/ReplyForm.php
+++ b/models/forms/ReplyForm.php
@@ -14,7 +14,6 @@
*/
class ReplyForm extends Model
{
-
/**
* @var Message
*/
@@ -45,7 +44,7 @@ public function validateRecipients($attribute)
{
if ($this->model->isBlocked()) {
$this->addError($attribute, Yii::t('MailModule.base', 'You are not allowed to reply to users {userNames}!', [
- 'userNames' => implode(', ', $this->model->getBlockerNames())
+ 'userNames' => implode(', ', $this->model->getBlockerNames()),
]));
}
}
@@ -76,7 +75,7 @@ public function save()
$this->reply = new MessageEntry([
'message_id' => $this->model->id,
'user_id' => Yii::$app->user->id,
- 'content' => $this->message
+ 'content' => $this->message,
]);
if ($this->reply->save()) {
diff --git a/models/states/AbstractMessageState.php b/models/states/AbstractMessageState.php
index 1ed4d6db..adcdcc27 100644
--- a/models/states/AbstractMessageState.php
+++ b/models/states/AbstractMessageState.php
@@ -47,4 +47,4 @@ public static function inform(Message $message, User $user): bool
{
return static::createForMessage($message, $user)->save();
}
-}
\ No newline at end of file
+}
diff --git a/models/states/MessageUserJoined.php b/models/states/MessageUserJoined.php
index 914b52fa..3b5df22d 100644
--- a/models/states/MessageUserJoined.php
+++ b/models/states/MessageUserJoined.php
@@ -22,4 +22,4 @@ public static function type(): int
{
return self::TYPE_USER_JOINED;
}
-}
\ No newline at end of file
+}
diff --git a/models/states/MessageUserLeft.php b/models/states/MessageUserLeft.php
index bda4f178..b7710ea0 100644
--- a/models/states/MessageUserLeft.php
+++ b/models/states/MessageUserLeft.php
@@ -22,4 +22,4 @@ public static function type(): int
{
return self::TYPE_USER_LEFT;
}
-}
\ No newline at end of file
+}
diff --git a/notifications/ConversationNotification.php b/notifications/ConversationNotification.php
index e49aeb1f..550135b4 100644
--- a/notifications/ConversationNotification.php
+++ b/notifications/ConversationNotification.php
@@ -8,7 +8,6 @@
namespace humhub\modules\mail\notifications;
-
use humhub\modules\notification\components\BaseNotification;
class ConversationNotification extends BaseNotification
@@ -18,4 +17,4 @@ public function category()
return new ConversationNotificationCategory();
}
-}
\ No newline at end of file
+}
diff --git a/notifications/ConversationNotificationCategory.php b/notifications/ConversationNotificationCategory.php
index d8265a56..b40be7de 100644
--- a/notifications/ConversationNotificationCategory.php
+++ b/notifications/ConversationNotificationCategory.php
@@ -28,7 +28,7 @@ public function getFixedSettings()
{
$webTarget = Yii::createObject(WebTarget::class);
return [
- $webTarget->id
+ $webTarget->id,
];
}
@@ -47,4 +47,4 @@ public function getDescription()
{
return Yii::t('MailModule.base', 'Receive Notifications when someone opens a new conversation.');
}
-}
\ No newline at end of file
+}
diff --git a/notifications/MailNotification.php b/notifications/MailNotification.php
index 530c4775..0198afd8 100644
--- a/notifications/MailNotification.php
+++ b/notifications/MailNotification.php
@@ -17,4 +17,4 @@ public function category()
return new MailNotificationCategory();
}
-}
\ No newline at end of file
+}
diff --git a/notifications/MailNotificationCategory.php b/notifications/MailNotificationCategory.php
index ef98655b..38030fa1 100644
--- a/notifications/MailNotificationCategory.php
+++ b/notifications/MailNotificationCategory.php
@@ -22,7 +22,7 @@ public function getFixedSettings()
{
$webTarget = Yii::createObject(WebTarget::class);
return [
- $webTarget->id
+ $webTarget->id,
];
}
@@ -41,4 +41,4 @@ public function getDescription()
{
return Yii::t('MailModule.base', 'Receive Notifications when someone sends you a message.');
}
-}
\ No newline at end of file
+}
diff --git a/permissions/SendMail.php b/permissions/SendMail.php
index 85731407..bab7a8bb 100644
--- a/permissions/SendMail.php
+++ b/permissions/SendMail.php
@@ -17,7 +17,6 @@
*/
class SendMail extends \humhub\libs\BasePermission
{
-
/**
* @inheritdoc
*/
@@ -28,14 +27,14 @@ class SendMail extends \humhub\libs\BasePermission
*/
public $defaultAllowedGroups = [
User::USERGROUP_USER,
- User::USERGROUP_FRIEND
+ User::USERGROUP_FRIEND,
];
/**
* @inheritdoc
*/
protected $fixedGroups = [
- User::USERGROUP_GUEST
+ User::USERGROUP_GUEST,
];
/**
diff --git a/permissions/StartConversation.php b/permissions/StartConversation.php
index e215bd7c..7334888b 100644
--- a/permissions/StartConversation.php
+++ b/permissions/StartConversation.php
@@ -16,7 +16,6 @@
*/
class StartConversation extends \humhub\libs\BasePermission
{
-
/**
* @inheritdoc
*/
diff --git a/tests/codeception/_support/AcceptanceTester.php b/tests/codeception/_support/AcceptanceTester.php
index 14ef6692..8d46ebed 100644
--- a/tests/codeception/_support/AcceptanceTester.php
+++ b/tests/codeception/_support/AcceptanceTester.php
@@ -1,4 +1,5 @@
getModule('Yii2')->_loadPage('POST', 'index-test.php?r=mail/mail/create',
- ['CreateMessage[recipient][]' => $recipient,
- 'CreateMessage[title]' => $title,
- 'CreateMessage[message]' => $message]);
+ $result = $this->getModule('Yii2')->_loadPage(
+ 'POST',
+ 'index-test.php?r=mail/mail/create',
+ ['CreateMessage[recipient][]' => $recipient,
+ 'CreateMessage[title]' => $title,
+ 'CreateMessage[message]' => $message],
+ );
}
}
diff --git a/tests/codeception/_support/FunctionalTester.php b/tests/codeception/_support/FunctionalTester.php
index 6c59c2e8..9e5672de 100644
--- a/tests/codeception/_support/FunctionalTester.php
+++ b/tests/codeception/_support/FunctionalTester.php
@@ -1,4 +1,5 @@
sendMessage($I, 'Sara', 'Hello there!', 'Just a test message.');
$I->expectTo('see my message overview with the new conversation');
- $I->waitForText('Hello there!', null,'#mail-conversation-header');
+ $I->waitForText('Hello there!', null, '#mail-conversation-header');
}
private function sendMessage(AcceptanceTester $I, $recipient, $title, $message)
@@ -60,7 +61,7 @@ private function sendMessage(AcceptanceTester $I, $recipient, $title, $message)
$I->wait(2);
$I->fillField('#createmessage-title', $title);
$I->fillField('#createmessage-message .humhub-ui-richtext', $message);
- $I->click('Send','#globalModal');
+ $I->click('Send', '#globalModal');
}
private function addParticipant(AcceptanceTester $I)
@@ -84,7 +85,7 @@ private function createConversationByInbox(AcceptanceTester $I)
$I->click('#mail-conversation-create-button');
$I->waitForText('New message', 10, '#globalModal');
$this->sendMessage($I, 'Admin', 'Hi Admin!', 'Admin test message');
- $I->waitForText('Admin test message', null,'#mail-conversation-root');
+ $I->waitForText('Admin test message', null, '#mail-conversation-root');
$I->see('Hi Admin!', '#mail-conversation-root');
}
@@ -121,7 +122,7 @@ private function seeNewMessagesAndEnterOverview(AcceptanceTester $I)
$I->waitForElementVisible('#create-message-button');
$I->click('Show all messages');
$I->expectTo('see my message overview with the new conversation');
- $I->waitForText('Hello there!', null,'#mail-conversation-root');
+ $I->waitForText('Hello there!', null, '#mail-conversation-root');
$I->see('Just a test message.');
}
@@ -130,14 +131,14 @@ private function leaveConversation(AcceptanceTester $I)
$I->click('#conversation-settings-button');
$I->wait(1);
$I->click('Leave conversation', '#mail-conversation-header');
- $I->waitForText('Confirm leaving conversation', null,'#globalModalConfirm');
+ $I->waitForText('Confirm leaving conversation', null, '#globalModalConfirm');
$I->click('Leave', '#globalModalConfirm');
$I->waitForText('Third message title', null, '#mail-conversation-header');
$I->click('#conversation-settings-button');
$I->wait(1);
$I->click('Leave conversation', '#mail-conversation-header');
- $I->waitForText('Confirm leaving conversation', null,'#globalModalConfirm');
+ $I->waitForText('Confirm leaving conversation', null, '#globalModalConfirm');
$I->click('Leave', '#globalModalConfirm');
$I->expectTo('see an empty conversation box');
diff --git a/tests/codeception/acceptance/_bootstrap.php b/tests/codeception/acceptance/_bootstrap.php
index 0f508ca5..9e54876d 100644
--- a/tests/codeception/acceptance/_bootstrap.php
+++ b/tests/codeception/acceptance/_bootstrap.php
@@ -3,4 +3,4 @@
* Initialize the HumHub Application for functional testing. The default application configuration for this suite can be overwritten
* in @tests/config/functional.php
*/
-require(Yii::getAlias('@humhubTests/codeception/acceptance/_bootstrap.php'));
\ No newline at end of file
+require(Yii::getAlias('@humhubTests/codeception/acceptance/_bootstrap.php'));
diff --git a/tests/codeception/api/TagCest.php b/tests/codeception/api/TagCest.php
index d1213d0d..5c486de7 100644
--- a/tests/codeception/api/TagCest.php
+++ b/tests/codeception/api/TagCest.php
@@ -30,13 +30,14 @@ public function testUpdateTags(ApiTester $I)
$I->wantTo('update tags');
$I->amUser1();
- $I->seePaginationPutResponse('mail/2/tags',
+ $I->seePaginationPutResponse(
+ 'mail/2/tags',
['tags' => ['User1 tag 1', 'User1 tag 2', 'User1 tag 3']],
[
['id' => 7, 'name' => 'User1 tag 1'],
['id' => 8, 'name' => 'User1 tag 2'],
['id' => 9, 'name' => 'User1 tag 3'],
- ]
+ ],
);
}
diff --git a/tests/codeception/api/_bootstrap.php b/tests/codeception/api/_bootstrap.php
index 0f508ca5..9e54876d 100644
--- a/tests/codeception/api/_bootstrap.php
+++ b/tests/codeception/api/_bootstrap.php
@@ -3,4 +3,4 @@
* Initialize the HumHub Application for functional testing. The default application configuration for this suite can be overwritten
* in @tests/config/functional.php
*/
-require(Yii::getAlias('@humhubTests/codeception/acceptance/_bootstrap.php'));
\ No newline at end of file
+require(Yii::getAlias('@humhubTests/codeception/acceptance/_bootstrap.php'));
diff --git a/tests/codeception/fixtures/ConversationTagFixture.php b/tests/codeception/fixtures/ConversationTagFixture.php
index 9685c817..e250dbd9 100644
--- a/tests/codeception/fixtures/ConversationTagFixture.php
+++ b/tests/codeception/fixtures/ConversationTagFixture.php
@@ -13,7 +13,6 @@
class ConversationTagFixture extends ActiveFixture
{
-
public $modelClass = UserMessageTag::class;
public $dataFile = '@mail/tests/codeception/fixtures/data/user_message_tag.php';
diff --git a/tests/codeception/fixtures/MessageEntryFixture.php b/tests/codeception/fixtures/MessageEntryFixture.php
index c7f82e9d..b760f35c 100644
--- a/tests/codeception/fixtures/MessageEntryFixture.php
+++ b/tests/codeception/fixtures/MessageEntryFixture.php
@@ -12,7 +12,6 @@
class MessageEntryFixture extends ActiveFixture
{
-
public $modelClass = 'humhub\modules\mail\models\MessageEntry';
}
diff --git a/tests/codeception/fixtures/MessageFixture.php b/tests/codeception/fixtures/MessageFixture.php
index 6fdf0c30..56625bce 100644
--- a/tests/codeception/fixtures/MessageFixture.php
+++ b/tests/codeception/fixtures/MessageFixture.php
@@ -13,7 +13,6 @@
class MessageFixture extends ActiveFixture
{
-
public $modelClass = Message::class;
public $depends = [
MessageEntryFixture::class,
diff --git a/tests/codeception/fixtures/UserMessageFixture.php b/tests/codeception/fixtures/UserMessageFixture.php
index 4d6c2574..8afd616b 100644
--- a/tests/codeception/fixtures/UserMessageFixture.php
+++ b/tests/codeception/fixtures/UserMessageFixture.php
@@ -12,7 +12,6 @@
class UserMessageFixture extends ActiveFixture
{
-
public $modelClass = 'humhub\modules\mail\models\UserMessage';
}
diff --git a/tests/codeception/fixtures/UserMessageTagFixture.php b/tests/codeception/fixtures/UserMessageTagFixture.php
index abf55a77..8445c1aa 100644
--- a/tests/codeception/fixtures/UserMessageTagFixture.php
+++ b/tests/codeception/fixtures/UserMessageTagFixture.php
@@ -13,7 +13,6 @@
class UserMessageTagFixture extends ActiveFixture
{
-
public $modelClass = MessageTag::class;
public $dataFile = '@mail/tests/codeception/fixtures/data/message_tag.php';
diff --git a/tests/codeception/fixtures/data/conversation_tag.php b/tests/codeception/fixtures/data/conversation_tag.php
index 3b5f6c57..bac5f292 100644
--- a/tests/codeception/fixtures/data/conversation_tag.php
+++ b/tests/codeception/fixtures/data/conversation_tag.php
@@ -18,4 +18,3 @@
* GNU Affero General Public License for more details.
*/
return [];
-
diff --git a/tests/codeception/fixtures/data/message.php b/tests/codeception/fixtures/data/message.php
index 74fd27e9..5e99f2cc 100644
--- a/tests/codeception/fixtures/data/message.php
+++ b/tests/codeception/fixtures/data/message.php
@@ -22,4 +22,3 @@
['id' => 2, 'title' => 'Second message title', 'created_by' => 1, 'created_at' => '2021-03-15 14:38:49'],
['id' => 3, 'title' => 'Third message title', 'created_by' => 1, 'created_at' => '2021-03-15 14:38:49'],
];
-
diff --git a/tests/codeception/fixtures/data/message_entry.php b/tests/codeception/fixtures/data/message_entry.php
index 84c70e9b..da731bdf 100644
--- a/tests/codeception/fixtures/data/message_entry.php
+++ b/tests/codeception/fixtures/data/message_entry.php
@@ -25,4 +25,3 @@
['id' => 5, 'message_id' => 3, 'user_id' => 2, 'content' => 'Third Message entry text 2.', 'created_by' => 2, 'created_at' => '2021-03-15 14:38:49'],
['id' => 6, 'message_id' => 3, 'user_id' => 3, 'content' => 'Third Message entry text 3.', 'created_by' => 3, 'created_at' => '2021-03-15 14:38:49'],
];
-
diff --git a/tests/codeception/fixtures/data/message_tag.php b/tests/codeception/fixtures/data/message_tag.php
index 87ef5090..053effce 100644
--- a/tests/codeception/fixtures/data/message_tag.php
+++ b/tests/codeception/fixtures/data/message_tag.php
@@ -25,4 +25,3 @@
['id' => 5, 'user_id' => 2, 'name' => 'Tag user2 2', 'sort_order' => 20],
['id' => 6, 'user_id' => 3, 'name' => 'Tag user3 1', 'sort_order' => 30],
];
-
diff --git a/tests/codeception/fixtures/data/user_message.php b/tests/codeception/fixtures/data/user_message.php
index 8101d1a2..fe9ca3e1 100644
--- a/tests/codeception/fixtures/data/user_message.php
+++ b/tests/codeception/fixtures/data/user_message.php
@@ -25,4 +25,3 @@
['message_id' => 3, 'user_id' => 2, 'is_originator' => 0, 'created_by' => 2, 'created_at' => '2021-03-15 14:38:49'],
['message_id' => 3, 'user_id' => 3, 'is_originator' => 0, 'created_by' => 3, 'created_at' => '2021-03-15 14:38:49'],
];
-
diff --git a/tests/codeception/fixtures/data/user_message_tag.php b/tests/codeception/fixtures/data/user_message_tag.php
index 608105f9..353587e1 100644
--- a/tests/codeception/fixtures/data/user_message_tag.php
+++ b/tests/codeception/fixtures/data/user_message_tag.php
@@ -25,4 +25,3 @@
['message_id' => 2, 'user_id' => 2, 'tag_id' => 5],
['message_id' => 3, 'user_id' => 1, 'tag_id' => 6],
];
-
diff --git a/tests/codeception/functional/SendMailCest.php b/tests/codeception/functional/SendMailCest.php
index 605b7770..4e96ae5e 100644
--- a/tests/codeception/functional/SendMailCest.php
+++ b/tests/codeception/functional/SendMailCest.php
@@ -1,6 +1,6 @@
amUser();
$I->wantToTest('if sending messages works');
-
+
$I->amGoingTo('send a message to another user');
$I->sendMessage('01e50e0d-82cd-41fc-8b0c-552392f5839e', 'TestTitle', 'TestMessage');
$I->expect('the new message in the database');
@@ -19,21 +19,21 @@ public function testSendMail(FunctionalTester $I)
$I->seeRecord('humhub\modules\mail\models\MessageEntry', ['message_id' => $message->id, 'content' => 'TestMessage']);
$I->seeRecord('humhub\modules\mail\models\UserMessage', ['message_id' => $message->id, 'user_id' => 2, 'is_originator' => 1]);
$I->seeRecord('humhub\modules\mail\models\UserMessage', ['message_id' => $message->id, 'user_id' => 3]);
-
+
$I->amGoingTo('check my conversation overview');
$I->amOnPage(['/mail/mail/index']);
-
+
$I->expect('to see the new message');
$I->see('Conversation');
$I->dontSee('There are no messages yet.');
$I->see('TestTitle');
$I->see('TestMessage');
}
-
+
// send mail to multiple recipients
// permissions
// friendship
// Add user
// Delete Message
// Notification
-}
\ No newline at end of file
+}
diff --git a/tests/codeception/functional/_bootstrap.php b/tests/codeception/functional/_bootstrap.php
index 11393b6a..d52c411e 100644
--- a/tests/codeception/functional/_bootstrap.php
+++ b/tests/codeception/functional/_bootstrap.php
@@ -3,4 +3,4 @@
* Initialize the HumHub Application for functional testing. The default application configuration for this suite can be overwritten
* in @tests/config/functional.php
*/
-require(Yii::getAlias('@humhubTests/codeception/functional/_bootstrap.php'));
\ No newline at end of file
+require(Yii::getAlias('@humhubTests/codeception/functional/_bootstrap.php'));
diff --git a/tests/codeception/unit/InboxFilterFormTest.php b/tests/codeception/unit/InboxFilterFormTest.php
index ef4b8287..2a3fb748 100644
--- a/tests/codeception/unit/InboxFilterFormTest.php
+++ b/tests/codeception/unit/InboxFilterFormTest.php
@@ -30,7 +30,7 @@ private function createMessage($title, $message, $users = null, $tags = [])
'title' => $title,
'message' => $message,
'recipient' => $users,
- 'tags' => $tags
+ 'tags' => $tags,
]);
$this->assertTrue($message->save());
@@ -68,7 +68,7 @@ public function testParticipationFilterMatchesSingleUser()
$user3 = User::findOne(['id' => 4]);
$message1 = $this->createMessage('First', 'First', [$user2->guid]);
- $message2 = $this->createMessage('Second', 'First', [$user3->guid]);
+ $message2 = $this->createMessage('Second', 'First', [$user3->guid]);
$filter = new InboxFilterForm(['participants' => [$user3->guid]]);
$filter->apply();
@@ -83,8 +83,8 @@ public function testParticipationFilterOnlyIncludesMessagesWithAllUsers()
$user3 = User::findOne(['id' => 4]);
$message1 = $this->createMessage('First', 'First', [$user2->guid]);
- $message2 = $this->createMessage('Second', 'First', [$user3->guid]);
- $message3 = $this->createMessage('Third', 'Third', [$user3->guid, $user2->guid]);
+ $message2 = $this->createMessage('Second', 'First', [$user3->guid]);
+ $message3 = $this->createMessage('Third', 'Third', [$user3->guid, $user2->guid]);
$filter = new InboxFilterForm(['participants' => [$user3->guid, $user2->guid]]);
$filter->apply();
@@ -116,7 +116,7 @@ public function testMultipleTagFilter()
$userTag2 = MessageTag::findOne(['name' => 'TestTag2']);
$message2 = $this->createMessage('Second', 'First', null, [$userTag->id]);
- $message3 = $this->createMessage('Third', 'Third', null, [$userTag2->id]);
+ $message3 = $this->createMessage('Third', 'Third', null, [$userTag2->id]);
$userTag = MessageTag::findOne(['name' => 'TestTag']);
@@ -127,4 +127,4 @@ public function testMultipleTagFilter()
$this->assertEquals($message1->messageInstance->id, $result[0]->message_id);
}
-}
\ No newline at end of file
+}
diff --git a/tests/codeception/unit/NotificationTest.php b/tests/codeception/unit/NotificationTest.php
index 221f1795..532acd1a 100644
--- a/tests/codeception/unit/NotificationTest.php
+++ b/tests/codeception/unit/NotificationTest.php
@@ -37,7 +37,7 @@ private function createMessage($title, $message, $users = null, $tags = []): Cre
'title' => $title,
'message' => $message,
'recipient' => $users,
- 'tags' => $tags
+ 'tags' => $tags,
]);
$this->assertTrue($message->save());
@@ -73,7 +73,7 @@ public function testNotificationsAreSentWhenCreatingAMessage()
$this->assertEqualsLastEmailSubject('New conversation from Peter Tester');
$this->assertEqualsLastEmailTo($user2->email);
$test = Live::find()->all();
- $this->assertCount(1, Live::find()->where(['contentcontainer_id' => $user2->contentcontainer_id])->all());
+ $this->assertCount(1, Live::find()->where(['contentcontainer_id' => $user2->contentcontainer_id])->all());
}
public function testNotificationsAreSentAllRecepients()
@@ -92,8 +92,8 @@ public function testNotificationsAreSentAllRecepients()
$test = Live::find(['contentcontainer_id' => $user2->contentcontainer_id])->all();
$test2 = unserialize($test[0]->serialized_data);
$test3 = unserialize($test[1]->serialized_data);
- $this->assertCount(1, Live::find()->where(['contentcontainer_id' => $user2->contentcontainer_id])->all());
- $this->assertCount(1, Live::find()->where(['contentcontainer_id' => $user3->contentcontainer_id])->all());
+ $this->assertCount(1, Live::find()->where(['contentcontainer_id' => $user2->contentcontainer_id])->all());
+ $this->assertCount(1, Live::find()->where(['contentcontainer_id' => $user3->contentcontainer_id])->all());
}
public function testNotificationsAreSentAfterAddingParticipant()
diff --git a/tests/codeception/unit/UserMessageTagTest.php b/tests/codeception/unit/UserMessageTagTest.php
index b3650213..dee8d666 100644
--- a/tests/codeception/unit/UserMessageTagTest.php
+++ b/tests/codeception/unit/UserMessageTagTest.php
@@ -18,7 +18,7 @@ private function createMessage($tags = [])
'message' => 'Hey!',
'title' => 'Test Conversation',
'recipient' => [$user2->guid],
- 'tags' => $tags
+ 'tags' => $tags,
]);
$this->assertTrue($message->save());
@@ -26,20 +26,20 @@ private function createMessage($tags = [])
return $message;
}
- public function testSingleTagIsCreatedOnMessageCreation()
- {
- $message = $this->createMessage( ['_add:TestTag']);
+ public function testSingleTagIsCreatedOnMessageCreation()
+ {
+ $message = $this->createMessage(['_add:TestTag']);
- $this->assertCount(7, MessageTag::find()->all());
- $this->assertCount(7, UserMessageTag::find()->all());
+ $this->assertCount(7, MessageTag::find()->all());
+ $this->assertCount(7, UserMessageTag::find()->all());
- /** @var MessageTag[] $tag */
- $tags = MessageTag::findByMessage(Yii::$app->user->id, $message->messageInstance)->all();
- $this->assertNotNull($tags);
- $this->assertCount(1, $tags);
- $this->assertEquals(Yii::$app->user->id, $tags[0]->user_id);
- $this->assertEquals('TestTag', $tags[0]->name);
- }
+ /** @var MessageTag[] $tag */
+ $tags = MessageTag::findByMessage(Yii::$app->user->id, $message->messageInstance)->all();
+ $this->assertNotNull($tags);
+ $this->assertCount(1, $tags);
+ $this->assertEquals(Yii::$app->user->id, $tags[0]->user_id);
+ $this->assertEquals('TestTag', $tags[0]->name);
+ }
public function testMultipleTagIsCreatedOnMessageCreation()
{
@@ -54,8 +54,8 @@ public function testMultipleTagIsCreatedOnMessageCreation()
$this->assertCount(2, $tags);
$this->assertEquals(Yii::$app->user->id, $tags[0]->user_id);
$this->assertEquals(Yii::$app->user->id, $tags[1]->user_id);
- $this->assertEquals('TestTag', $tags[0]->name);
- $this->assertEquals('TestTag2', $tags[1]->name);
+ $this->assertEquals('TestTag', $tags[0]->name);
+ $this->assertEquals('TestTag2', $tags[1]->name);
}
public function testDuplicateTagIsAttachedOnlyOnce()
@@ -70,7 +70,7 @@ public function testDuplicateTagIsAttachedOnlyOnce()
$this->assertNotNull($tags);
$this->assertCount(1, $tags);
$this->assertEquals(Yii::$app->user->id, $tags[0]->user_id);
- $this->assertEquals('TestTag', $tags[0]->name);
+ $this->assertEquals('TestTag', $tags[0]->name);
}
public function testMissingTagsAreDeletedOnAttach()
@@ -85,4 +85,4 @@ public function testMissingTagsAreDeletedOnAttach()
$this->assertCount(1, $updatedTags);
$this->assertEquals('TestTag', $updatedTags[0]->name);
}
-}
\ No newline at end of file
+}
diff --git a/tests/codeception/unit/UserRestrictionTest.php b/tests/codeception/unit/UserRestrictionTest.php
index fac0a45b..d72289cc 100644
--- a/tests/codeception/unit/UserRestrictionTest.php
+++ b/tests/codeception/unit/UserRestrictionTest.php
@@ -11,7 +11,6 @@
class UserRestrictionTest extends HumHubDbTestCase
{
-
/**
* Test registration with whitelist and valid email (with approval process) -> user should be enabled.
* TODO: Its not possible to completely deny conversations
@@ -48,7 +47,7 @@ public function testFewConversationsAllowed()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
@@ -57,7 +56,7 @@ public function testFewConversationsAllowed()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
@@ -66,7 +65,7 @@ public function testFewConversationsAllowed()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
@@ -75,7 +74,7 @@ public function testFewConversationsAllowed()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
$this->assertFalse($message->save());
@@ -103,7 +102,7 @@ public function testNewUserRestriction()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
@@ -112,7 +111,7 @@ public function testNewUserRestriction()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
$this->assertFalse($message->save());
@@ -140,7 +139,7 @@ public function testNewUserRestrictionTwo()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
@@ -149,7 +148,7 @@ public function testNewUserRestrictionTwo()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
$this->assertTrue($message->save());
@@ -157,7 +156,7 @@ public function testNewUserRestrictionTwo()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
$this->assertFalse($message->save());
@@ -176,7 +175,7 @@ public function testResetConversationCount()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
@@ -185,7 +184,7 @@ public function testResetConversationCount()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
$this->assertFalse($message->save());
@@ -196,7 +195,7 @@ public function testResetConversationCount()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
$this->assertTrue($message->save());
@@ -204,7 +203,7 @@ public function testResetConversationCount()
$message = new CreateMessage([
'recipient' => User::findOne(['id' => 1]),
'title' => 'Test title',
- 'message' => 'Test message'
+ 'message' => 'Test message',
]);
$this->assertFalse($message->save());
diff --git a/tests/config/test.php b/tests/config/test.php
index 0fb5e769..c3eb9f1a 100644
--- a/tests/config/test.php
+++ b/tests/config/test.php
@@ -4,6 +4,6 @@
'modules' => ['mail'],
'fixtures' => [
'default',
- 'message' => 'tests\codeception\fixtures\MessageFixture'
- ]
+ 'message' => 'tests\codeception\fixtures\MessageFixture',
+ ],
];
diff --git a/widgets/ConversationDateBadge.php b/widgets/ConversationDateBadge.php
index 646c4fd1..b907ddf3 100644
--- a/widgets/ConversationDateBadge.php
+++ b/widgets/ConversationDateBadge.php
@@ -52,4 +52,4 @@ private function isDate(string $date): bool
return $this->getFormattedEntryDate() === Yii::$app->formatter->asDate($datetime, $this->format);
}
-}
\ No newline at end of file
+}
diff --git a/widgets/ConversationEntry.php b/widgets/ConversationEntry.php
index 46cc6d14..0bead0b2 100644
--- a/widgets/ConversationEntry.php
+++ b/widgets/ConversationEntry.php
@@ -39,7 +39,7 @@ class ConversationEntry extends JsWidget
public bool $showDateBadge = true;
public array $userColors = ['#34568B', '#FF6F61', '#6B5B95', '#88B04B', '#92A8D1', '#955251', '#B565A7', '#009B77',
- '#DD4124', '#D65076', '#45B8AC', '#EFC050', '#5B5EA6', '#9B2335', '#55B4B0', '#E15D44', '#BC243C', '#C3447A'
+ '#DD4124', '#D65076', '#45B8AC', '#EFC050', '#5B5EA6', '#9B2335', '#55B4B0', '#E15D44', '#BC243C', '#C3447A',
];
/**
@@ -64,7 +64,7 @@ public function runMessage(): string
'showUser' => $showUser,
'userColor' => $showUser ? $this->getUserColor() : null,
'showDateBadge' => $this->showDateBadge(),
- 'options' => $this->getOptions()
+ 'options' => $this->getOptions(),
]);
}
@@ -72,7 +72,7 @@ public function runState(): string
{
return $this->render('conversationState', [
'entry' => $this->entry,
- 'showDateBadge' => $this->showDateBadge()
+ 'showDateBadge' => $this->showDateBadge(),
]);
}
@@ -96,14 +96,14 @@ public function getData()
{
return [
'entry-id' => $this->entry->id,
- 'delete-url' => Url::toDeleteMessageEntry($this->entry)
+ 'delete-url' => Url::toDeleteMessageEntry($this->entry),
];
}
public function getAttributes()
{
$result = [
- 'class' => 'media mail-conversation-entry'
+ 'class' => 'media mail-conversation-entry',
];
if ($this->isOwnMessage()) {
diff --git a/widgets/ConversationEntryMenu.php b/widgets/ConversationEntryMenu.php
index b5fc2046..23ad674f 100644
--- a/widgets/ConversationEntryMenu.php
+++ b/widgets/ConversationEntryMenu.php
@@ -53,4 +53,4 @@ public function run()
return $this->render('conversationEntryMenu', ['menus' => $this->menus]);
}
-}
\ No newline at end of file
+}
diff --git a/widgets/ConversationHeader.php b/widgets/ConversationHeader.php
index f4396ddb..03ff2590 100644
--- a/widgets/ConversationHeader.php
+++ b/widgets/ConversationHeader.php
@@ -1,9 +1,7 @@
render('conversationHeader', ['message' => $this->message]);
}
-}
\ No newline at end of file
+}
diff --git a/widgets/ConversationInbox.php b/widgets/ConversationInbox.php
index a5c0b146..35bed7af 100644
--- a/widgets/ConversationInbox.php
+++ b/widgets/ConversationInbox.php
@@ -1,9 +1,7 @@
render('inbox', [
'options' => $this->getOptions(),
- 'userMessages' => $this->result
+ 'userMessages' => $this->result,
]);
}
@@ -65,15 +63,15 @@ public function getData()
'widget-reload-url' => Url::toUpdateInbox(),
'load-more-url' => Url::toInboxLoadMore(),
'update-entries-url' => Url::toInboxUpdateEntries(),
- 'is-last' => $this->filter->wasLastPage()
+ 'is-last' => $this->filter->wasLastPage(),
];
}
public function getAttributes()
{
return [
- 'class' => 'media-list'
+ 'class' => 'media-list',
];
}
-}
\ No newline at end of file
+}
diff --git a/widgets/ConversationSettingsMenu.php b/widgets/ConversationSettingsMenu.php
index c93e0327..9ccf2ac3 100644
--- a/widgets/ConversationSettingsMenu.php
+++ b/widgets/ConversationSettingsMenu.php
@@ -22,8 +22,8 @@ public function run()
return $this->render('conversationSettingsMenu', [
'message' => $this->message,
'isSingleParticipant' => $this->message->getUsers()->count() === 1,
- 'canAddParticipant' => Yii::$app->user->can(StartConversation::class)
+ 'canAddParticipant' => Yii::$app->user->can(StartConversation::class),
]);
}
-}
\ No newline at end of file
+}
diff --git a/widgets/ConversationTagBadge.php b/widgets/ConversationTagBadge.php
index 94c85842..c5b3f0ed 100644
--- a/widgets/ConversationTagBadge.php
+++ b/widgets/ConversationTagBadge.php
@@ -1,9 +1,7 @@
withLink(Link::withAction(null, 'mail.inbox.setTagFilter')->options([
'data-tag-id' => $tag->id,
'data-tag-name' => $tag->name,
- 'data-tag-image' => Icon::get('star')
+ 'data-tag-image' => Icon::get('star'),
]));
}
public static function getEditConversationTagBadge(Message $message, $icon = 'pencil')
{
return static::defaultType()->icon($icon)
- ->withLink(Link::withAction(null, 'ui.modal.load', Url::toEditConversationTags($message) ));
+ ->withLink(Link::withAction(null, 'ui.modal.load', Url::toEditConversationTags($message)));
}
-}
\ No newline at end of file
+}
diff --git a/widgets/ConversationTagPicker.php b/widgets/ConversationTagPicker.php
index fc0e228f..adb469a0 100644
--- a/widgets/ConversationTagPicker.php
+++ b/widgets/ConversationTagPicker.php
@@ -1,9 +1,7 @@
asString();
}
-}
\ No newline at end of file
+}
diff --git a/widgets/ConversationTags.php b/widgets/ConversationTags.php
index 827df83a..4b53fc9e 100644
--- a/widgets/ConversationTags.php
+++ b/widgets/ConversationTags.php
@@ -1,9 +1,7 @@
user->id, $this->message)->all();
+ {
+ $tags = MessageTag::findByMessage(Yii::$app->user->id, $this->message)->all();
$result = Html::beginTag('div', ['id' => static::ID, 'class' => 'panel-body', 'style' => ['display' => count($tags) ? 'block' : 'none']]);
- $result .= ''.Yii::t('MailModule.base', 'My Tags').'';
+ $result .= '' . Yii::t('MailModule.base', 'My Tags') . '';
foreach ($tags as $tag) {
- $result .= ConversationTagBadge::get($tag).' ';
+ $result .= ConversationTagBadge::get($tag) . ' ';
}
$result .= ConversationTagBadge::getEditConversationTagBadge($this->message, (empty($tags) ? 'plus' : 'pencil'));
@@ -32,4 +31,4 @@ public function run()
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/widgets/ConversationView.php b/widgets/ConversationView.php
index 6e46987f..a291d45d 100644
--- a/widgets/ConversationView.php
+++ b/widgets/ConversationView.php
@@ -40,7 +40,7 @@ public function getData()
'load-message-url' => Url::toLoadMessage(),
'load-update-url' => Url::toUpdateMessage(),
'load-more-url' => Url::toLoadMoreMessages(),
- 'mark-seen-url' => Url::toNotificationSeen()
+ 'mark-seen-url' => Url::toNotificationSeen(),
];
}
-}
\ No newline at end of file
+}
diff --git a/widgets/InboxFilter.php b/widgets/InboxFilter.php
index b37434ec..95ae84bd 100644
--- a/widgets/InboxFilter.php
+++ b/widgets/InboxFilter.php
@@ -1,9 +1,7 @@
render('inboxFilter', ['options' => $this->getOptions(), 'model' => $this->model]);
}
-}
\ No newline at end of file
+}
diff --git a/widgets/MailRichtextEditor.php b/widgets/MailRichtextEditor.php
index d2899d45..d567a489 100644
--- a/widgets/MailRichtextEditor.php
+++ b/widgets/MailRichtextEditor.php
@@ -7,7 +7,6 @@
namespace humhub\modules\mail\widgets;
-
use humhub\modules\content\widgets\richtext\ProsemirrorRichTextEditor;
use Yii;
@@ -19,4 +18,4 @@ public function init()
$this->placeholder = Yii::t('MailModule.base', 'Write a message...');
parent::init(); // TODO: Change the autogenerated stub
}
-}
\ No newline at end of file
+}
diff --git a/widgets/ManageTagsLink.php b/widgets/ManageTagsLink.php
index 1426503d..81870c3e 100644
--- a/widgets/ManageTagsLink.php
+++ b/widgets/ManageTagsLink.php
@@ -1,9 +1,7 @@
icon('gear')->right()->cssClass('manage-tags-link');
}
-}
\ No newline at end of file
+}
diff --git a/widgets/MessageEntryTime.php b/widgets/MessageEntryTime.php
index d7c3fbb5..cd303ed1 100644
--- a/widgets/MessageEntryTime.php
+++ b/widgets/MessageEntryTime.php
@@ -41,4 +41,4 @@ protected function renderStatus(): string
return Html::tag('span', Yii::t('MailModule.base', 'edited') . $this->statusSeparator, $this->statusOptions);
}
-}
\ No newline at end of file
+}
diff --git a/widgets/Messages.php b/widgets/Messages.php
index 8c501bb4..2c4fe045 100644
--- a/widgets/Messages.php
+++ b/widgets/Messages.php
@@ -1,9 +1,7 @@
$entry,
'prevEntry' => $prevEntry,
'nextEntry' => $nextEntry,
- 'showDateBadge' => $this->showDateBadge
+ 'showDateBadge' => $this->showDateBadge,
]);
$prevEntry = $entry;
} catch (\Throwable $e) {
@@ -67,4 +65,4 @@ private function getEntries()
return $this->message->getEntryPage($this->from);
}
-}
\ No newline at end of file
+}
diff --git a/widgets/NewMessageButton.php b/widgets/NewMessageButton.php
index ec000660..9d92adf4 100644
--- a/widgets/NewMessageButton.php
+++ b/widgets/NewMessageButton.php
@@ -9,7 +9,6 @@
class NewMessageButton extends Widget
{
-
/**
* @var string
*/
@@ -36,7 +35,7 @@ class NewMessageButton extends Widget
public $label;
/**
- * @var boolean
+ * @var bool
*/
public $right = false;
@@ -93,5 +92,3 @@ public function getLabel()
: Yii::t('MailModule.base', 'Message');
}
}
-
-?>
\ No newline at end of file
diff --git a/widgets/NotificationInbox.php b/widgets/NotificationInbox.php
index 8f3b9cac..7457281e 100644
--- a/widgets/NotificationInbox.php
+++ b/widgets/NotificationInbox.php
@@ -10,14 +10,13 @@
*/
class NotificationInbox extends Widget
{
-
/**
* Creates the Wall Widget
*/
public function run()
{
return $this->render('notificationInbox', [
- 'newMailMessageCount' => UserMessage::getNewMessageCount()
+ 'newMailMessageCount' => UserMessage::getNewMessageCount(),
]);
}
-}
\ No newline at end of file
+}
diff --git a/widgets/Notifications.php b/widgets/Notifications.php
index c2e15e37..fc4213da 100644
--- a/widgets/Notifications.php
+++ b/widgets/Notifications.php
@@ -1,6 +1,5 @@
['visible-xs-inline', 'hidden-xs'],
6 => ['visible-md-inline visible-sm-inline', 'hidden-md hidden-sm'],
- 8 => ['visible-lg-inline', '']
+ 8 => ['visible-lg-inline', ''],
];
public function run()
@@ -82,4 +82,4 @@ private function renderOtherCount(int $count): string
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/widgets/TimeAgo.php b/widgets/TimeAgo.php
index a5f634c7..9770a321 100644
--- a/widgets/TimeAgo.php
+++ b/widgets/TimeAgo.php
@@ -1,9 +1,7 @@