Skip to content

Commit

Permalink
Update MessageUserLeft.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchBlood authored Nov 5, 2024
1 parent 599fd98 commit bb46aed
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions models/states/MessageUserLeft.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2023 HumHub GmbH & Co. KG
Expand All @@ -15,11 +16,43 @@
*/
class MessageUserLeft extends AbstractMessageState
{
/**
* The default value for the 'enableMessageUserLeft' setting.
*/
const DEFAULT_ENABLE_MESSAGE_USER_LEFT = true;

/**
* The key for the 'enableMessageUserLeft' setting.
*/
const SETTING_ENABLE_MESSAGE_USER_LEFT = 'enableMessageUserLeft';

/**
* @inheritdoc
*/
public static function type(): int
{
return self::TYPE_USER_LEFT;
}

/**
* Checks if the MessageUserLeft state is enabled.
*
* @param array $settings The settings array, where the 'enableMessageUserLeft' setting is stored.
* @return bool
*/
public static function isEnabled(array $settings): bool
{
return $settings[self::SETTING_ENABLE_MESSAGE_USER_LEFT] ?? self::DEFAULT_ENABLE_MESSAGE_USER_LEFT;
}

/**
* Checks if the MessageUserLeft state is disabled.
*
* @param array $settings The settings array, where the 'enableMessageUserLeft' setting is stored.
* @return bool
*/
public static function isDisabled(array $settings): bool
{
return !self::isEnabled($settings);
}
}

0 comments on commit bb46aed

Please sign in to comment.