Version 5.0.6

This commit is contained in:
Neo committed 2025-12-19 18:55:49 -08:00
1 parent a3a4a9ccbd
commit b89858b2ff
1214 files changed
+92828 -14859

No files matched your search

@@ -159,6 +159,21 @@ class Conversation extends Item
return FALSE;
}
/**
* Show/hide the "Compose New" button in the messenger
* This differs from @see canCreate() because some groups may have a limit per day,
* in which case we show the button, because it will tell them they have
* reached their limit.
* Other groups may have no permission at all, so we hide the button entirely.
*
* @param Member $member
* @return bool
*/
public static function showComposeButton( Member $member ) : bool
{
return static::canCreate( $member ) and $member->group['g_pm_perday'] != 0;
}
/**
* Can a given member create this type of content?
*
@@ -205,6 +220,17 @@ class Conversation extends Item
/* Have we exceeded our limit for the day/minute? */
if ( $member->group['g_pm_perday'] !== -1 )
{
/* Members that have a zero limit can never send */
if( $member->group['g_pm_perday'] == 0 )
{
if ( $showError )
{
Output::i()->error( $member->language()->addToStack( 'module_no_permission' ), '1C149/25', 429, '' );
}
return false;
}
$messagesSentToday = Db::i()->select( 'COUNT(*) AS count, MAX(mt_date) AS max', 'core_message_topics', array( 'mt_starter_id=? AND mt_date>?', $member->member_id, DateTime::create()->sub( new DateInterval( 'P1D' ) )->getTimeStamp() ) )->first();
if ( $messagesSentToday['count'] >= $member->group['g_pm_perday'] )
{
@@ -584,7 +610,7 @@ class Conversation extends Item
*/
public function get_activeParticipants() : int
{
return count( array_filter( $this->maps, function( $map )
return count( array_filter( $this->maps(), function( $map )
{
return $map['map_user_active'];
} ) );