-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update styles of message block * Create LESS file * Scroll down button * Move person name into speech bubble * Remove profile data in direct message * Update conversation header style * Fix conversation header * Display time of conversation entry * Display date badge between day conversations * Update time position * Limit users list * Apply username colors * Fix tests * Show all messages on small screen * Implement message entry user states "joined" and "left" * Hide date on over conversation entry * Remove useless column `message_entry:file_id` * Update REST API docs * Fix entry time position * Fix space around entry state badge * Update Message Count * Updated Changelog * Updated minimized notificaation js * Changed Test to min version 1.12 * Update conversation panel header * Use full width container on fluid themes * Fix date and state badges visibility * Fix date badge visibility after reply * Update conversation panel header styles * Improve user names limit in conversation header * Update inbox styles * Update inbox styles * Update inbox styles --------- Co-authored-by: Lucas Bartholemy <[email protected]>
- Loading branch information
1 parent
9a5917a
commit f84e77e
Showing
55 changed files
with
3,578 additions
and
1,942 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: PHP Codeception Tests - v1.12 | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
tests: | ||
uses: humhub/actions/.github/workflows/module-tests-v1.12.yml@main | ||
with: | ||
module-id: mail | ||
use-rest-module: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
use humhub\components\Migration; | ||
use humhub\modules\mail\models\AbstractMessageEntry; | ||
use humhub\modules\mail\models\MessageEntry; | ||
|
||
/** | ||
* Class m230213_094842_add_state | ||
*/ | ||
class m230213_094842_add_entry_type extends Migration | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function safeUp() | ||
{ | ||
$this->safeAddColumn(AbstractMessageEntry::tableName(), 'type', $this->tinyInteger() | ||
->defaultValue(MessageEntry::type()) | ||
->notNull() | ||
->unsigned() | ||
->after('content') | ||
); | ||
$this->alterColumn(AbstractMessageEntry::tableName(), 'content', $this->text()->null()); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function safeDown() | ||
{ | ||
$this->safeDropColumn(AbstractMessageEntry::tableName(), 'type'); | ||
$this->alterColumn(AbstractMessageEntry::tableName(), 'content', $this->text()->notNull()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
use humhub\components\Migration; | ||
use humhub\modules\mail\models\MessageEntry; | ||
|
||
|
||
/** | ||
* Class m230214_062338_drop_file_id | ||
*/ | ||
class m230214_062338_drop_file_id extends Migration | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function safeUp() | ||
{ | ||
$this->safeDropColumn(MessageEntry::tableName(), 'file_id'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function safeDown() | ||
{ | ||
echo "m230214_062338_drop_file_id cannot be reverted.\n"; | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
<?php | ||
/** | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) 2023 HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
*/ | ||
|
||
namespace humhub\modules\mail\models; | ||
|
||
use humhub\components\ActiveRecord; | ||
use humhub\modules\content\widgets\richtext\RichText; | ||
use humhub\modules\mail\live\UserMessageDeleted; | ||
use humhub\modules\user\models\User; | ||
use Yii; | ||
use yii\db\ActiveQuery; | ||
|
||
/** | ||
* 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 string $content | ||
* @property integer $type | ||
* @property string $created_at | ||
* @property integer $created_by | ||
* @property string $updated_at | ||
* @property integer $updated_by | ||
* | ||
* The followings are the available model relations: | ||
* @property Message $message | ||
* @property User $user | ||
* | ||
* @package humhub.modules.mail.models | ||
* @since 2.1 | ||
*/ | ||
abstract class AbstractMessageEntry extends ActiveRecord | ||
{ | ||
const TYPE_MESSAGE = 0; | ||
const TYPE_USER_JOINED = 1; | ||
const TYPE_USER_LEFT = 2; | ||
|
||
protected bool $requiredContent = true; | ||
|
||
/** | ||
* Get type of the message entry | ||
* | ||
* @return int | ||
*/ | ||
abstract public static function type(): int; | ||
|
||
/** | ||
* Check if the given or current User can edit the message entry | ||
* | ||
* @param User|null $user | ||
* @return bool | ||
*/ | ||
abstract public function canEdit(?User $user = null): bool; | ||
|
||
/** | ||
* Notify Users about this message entry | ||
* | ||
* @var bool $isNewConversation | ||
*/ | ||
abstract public function notify(bool $isNewConversation = false); | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function tableName() | ||
{ | ||
return 'message_entry'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function rules() | ||
{ | ||
$requiredColumns = ['message_id', 'user_id']; | ||
|
||
if ($this->requiredContent) { | ||
$requiredColumns[] = 'content'; | ||
} | ||
|
||
return [ | ||
[$requiredColumns, 'required'], | ||
[['message_id', 'user_id', 'created_by', 'updated_by'], 'integer'], | ||
[['created_at', 'updated_at'], 'safe'], | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function init() | ||
{ | ||
parent::init(); | ||
$this->type = $this->type(); | ||
} | ||
|
||
/** | ||
* @param Message $message | ||
* @param User $user | ||
* @param string|null $content | ||
* @return self | ||
*/ | ||
public static function createForMessage(Message $message, User $user, ?string $content = null): self | ||
{ | ||
// Attach Message Entry | ||
return new static([ | ||
'message_id' => $message->id, | ||
'user_id' => $user->id, | ||
'content' => $content, | ||
'type' => static::type(), | ||
]); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function beforeSave($insert) | ||
{ | ||
if ($this->isNewRecord) { | ||
// Updates the updated_at attribute | ||
$this->message->save(); | ||
} | ||
|
||
return parent::beforeSave($insert); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function afterSave($insert, $changedAttributes) | ||
{ | ||
RichText::postProcess($this->content, $this); | ||
parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function afterDelete() | ||
{ | ||
foreach ($this->message->users as $user) { | ||
Yii::$app->live->send(new UserMessageDeleted([ | ||
'contentContainerId' => $user->contentcontainer_id, | ||
'message_id' => $this->message_id, | ||
'entry_id' => $this->id, | ||
'user_id' => $user->id | ||
])); | ||
} | ||
|
||
parent::afterDelete(); | ||
} | ||
|
||
public function getUser(): ActiveQuery | ||
{ | ||
return $this->hasOne(User::class, ['id' => 'user_id']); | ||
} | ||
|
||
public function getMessage(): ActiveQuery | ||
{ | ||
return $this->hasOne(Message::class, ['id' => 'message_id']); | ||
} | ||
} |
Oops, something went wrong.