Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-farre committed Oct 14, 2024
2 parents bd63705 + 92364ce commit f729c98
Show file tree
Hide file tree
Showing 188 changed files with 3,405 additions and 3,395 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: PHP CS Fixer

on: push

jobs:
fixers:
uses: humhub/actions/.github/workflows/module-php-cs-fixer.yml@main
18 changes: 9 additions & 9 deletions Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function onIntegrityCheck($event)
try {
foreach (Message::find()->each() as $message) {
/* @var $message Message */
if(!$message->getAuthor()->count()) {
if (!$message->getAuthor()->count()) {
if ($integrityController->showFix("Deleting conversation id " . $message->id . " without existing author!")) {
$message->delete();
}
Expand All @@ -53,12 +53,12 @@ public static function onIntegrityCheck($event)

foreach (MessageEntry::find()->each() as $messageEntry) {
/* @var $messageEntry MessageEntry */
if(!$messageEntry->getUser()->count()) {
if (!$messageEntry->getUser()->count()) {
if ($integrityController->showFix("Deleting message entry id " . $messageEntry->id . " without existing user!")) {
$messageEntry->delete();
}
}
if(!$messageEntry->message) {
if (!$messageEntry->message) {
if ($integrityController->showFix("Deleting message entry id " . $messageEntry->id . " without existing conversation!")) {
$messageEntry->delete();
}
Expand All @@ -69,7 +69,7 @@ public static function onIntegrityCheck($event)

foreach (UserMessage::find()->each() as $userMessage) {
/* @var $userMessage UserMessage */
if(!$userMessage->getUser()->count()) {
if (!$userMessage->getUser()->count()) {
if ($integrityController->showFix("Deleting user message id " . $userMessage->message_id . " without existing user!")) {
$userMessage->delete();
}
Expand All @@ -80,13 +80,13 @@ public static function onIntegrityCheck($event)

foreach (UserMessageTag::find()->each() as $messageTag) {
/* @var $messageTag UserMessageTag */
if(!$messageTag->getUser()->count()) {
if (!$messageTag->getUser()->count()) {
if ($integrityController->showFix("Deleting user tag id " . $messageTag->id . " without existing user!")) {
$messageTag->delete();
}
}
}
} catch(\Throwable $e) {
} catch (\Throwable $e) {
Yii::error($e);
}
}
Expand All @@ -109,7 +109,7 @@ public static function onUserDelete($event)
}

foreach (UserMessage::findAll(['user_id' => $event->sender->id]) as $userMessage) {
if($userMessage->message) {
if ($userMessage->message) {
$userMessage->message->leave($event->sender->id);
}

Expand All @@ -119,7 +119,7 @@ public static function onUserDelete($event)
foreach (UserMessageTag::findAll(['user_id' => $event->sender->id]) as $userMessageTag) {
$userMessageTag->delete();
}
} catch(\Throwable $e) {
} catch (\Throwable $e) {
Yii::error($e);
}

Expand Down Expand Up @@ -150,7 +150,7 @@ public static function onTopMenuInit($event)
'sortOrder' => 300,
]);
}
} catch(\Throwable $e) {
} catch (\Throwable $e) {
Yii::error($e);
}
}
Expand Down
11 changes: 5 additions & 6 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
class Module extends \humhub\components\Module
{

/**
* @inheritdoc
*/
Expand Down Expand Up @@ -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(),
];
}

Expand All @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion assets/MailMessengerAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ class MailMessengerAsset extends AssetBundle
];

public $depends = [
MailNotificationAsset::class
MailNotificationAsset::class,
];
}
8 changes: 4 additions & 4 deletions assets/MailNotificationAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MailNotificationAsset extends AssetBundle
];

public $depends = [
MailStyleAsset::class
MailStyleAsset::class,
];

public static function register($view)
Expand All @@ -34,10 +34,10 @@ public static function register($view)
'url' => [
'count' => Url::toMessageCountUpdate(),
'list' => Url::toNotificationList(),
]
]
],
],
]);

return parent::register($view);
}
}
}
4 changes: 2 additions & 2 deletions assets/MailStyleAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ class MailStyleAsset extends AssetBundle
];

public $css = [
'humhub.mail.min.css'
'humhub.mail.min.css',
];
}
}
3 changes: 0 additions & 3 deletions controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
class ConfigController extends \humhub\modules\admin\components\Controller
{

/**
* Configuration action for super admins.
*/
Expand All @@ -35,5 +34,3 @@ public function actionIndex()
return $this->render('index', ['model' => $form]);
}
}

?>
9 changes: 4 additions & 5 deletions controllers/InboxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@
*/
class InboxController extends Controller
{

/**
* @inheritdoc
*/
protected function getAccessRules()
{
return [
[ControllerAccess::RULE_LOGGED_IN_ONLY]
[ControllerAccess::RULE_LOGGED_IN_ONLY],
];
}

Expand All @@ -37,7 +36,7 @@ protected function getAccessRules()
public function actionIndex()
{
return ConversationInbox::widget([
'filter' => new InboxFilterForm()
'filter' => new InboxFilterForm(),
]);
}

Expand All @@ -50,14 +49,14 @@ public function actionLoadMore()
foreach ($userMessages as $userMessage) {
try {
$result .= InboxMessagePreview::widget(['userMessage' => $userMessage]);
} catch(\Throwable $e) {
} catch (\Throwable $e) {
Yii::error($e);
}
}

return $this->asJson([
'result' => $result,
'isLast' => $filter->wasLastPage()
'isLast' => $filter->wasLastPage(),
]);

}
Expand Down
43 changes: 21 additions & 22 deletions controllers/MailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
*/
class MailController extends Controller
{

/**
* @inheritdoc
*/
Expand All @@ -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']],
];
}

Expand Down Expand Up @@ -98,7 +97,7 @@ public function actionSeen()
}

return $this->asJson([
'messageCount' => UserMessage::getNewMessageCount()
'messageCount' => UserMessage::getNewMessageCount(),
]);
}

Expand All @@ -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,
]));
}

Expand All @@ -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),
]);
}

Expand All @@ -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'),
],
]);
}

Expand All @@ -163,7 +162,7 @@ public function actionUserList($id)
{
return $this->renderAjaxContent(UserListBox::widget([
'query' => $this->getMessage($id, true)->getUsers(),
'title' => '<strong>' . Yii::t('MailModule.base', 'Participants') . '</strong>'
'title' => '<strong>' . Yii::t('MailModule.base', 'Participants') . '</strong>',
]));
}

Expand All @@ -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'),
],
]);
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -266,7 +265,7 @@ private function checkMessagePermissions($message)
*
* @param type $message
* @param type $user
* @return boolean
* @return bool
*/
private function isParticipant($message, $user)
{
Expand Down Expand Up @@ -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']),
]);
}

Expand All @@ -372,7 +371,7 @@ public function actionPin($id)

return $this->asJson([
'success' => true,
'redirect' => Url::toMessenger($message)
'redirect' => Url::toMessenger($message),
]);
}

Expand All @@ -389,7 +388,7 @@ public function actionUnpin($id)

return $this->asJson([
'success' => true,
'redirect' => Url::toMessenger($message)
'redirect' => Url::toMessenger($message),
]);
}

Expand All @@ -411,7 +410,7 @@ public function actionLeave($id)

return $this->asJson([
'success' => true,
'redirect' => Url::toMessenger()
'redirect' => Url::toMessenger(),
]);
}

Expand Down Expand Up @@ -439,8 +438,8 @@ public function actionEditEntry($id)
'success' => true,
'content' => ConversationEntry::widget([
'entry' => $entry,
'showDateBadge' => false
])
'showDateBadge' => false,
]),
]);
}

Expand Down Expand Up @@ -472,7 +471,7 @@ public function actionDeleteEntry($id)
$entry->message->deleteEntry($entry);

return $this->asJson([
'success' => true
'success' => true,
]);
}

Expand Down Expand Up @@ -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();
}
Expand Down
Loading

0 comments on commit f729c98

Please sign in to comment.