Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief Personal Conversation Message Model
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 8 Jul 2013
* @version SVN_VERSION_NUMBER
*/
@@ -106,16 +106,18 @@ class _Message extends \IPS\Content\Comment implements \IPS\Content\ReportCenter
/**
* Create comment
*
* @param \IPS\Content\Item $item The content item just created
* @param string $comment The comment
* @param bool $first Is the first comment?
* @param string $guestName If author is a guest, the name to use
* @param \IPS\Content\Item $item The content item just created
* @param string $comment The comment
* @param bool $first Is the first comment?
* @param string $guestName If author is a guest, the name to use
* @param bool|NULL $incrementPostCount Increment post count? If NULL, will use static::incrementPostCount()
* @param \IPS\Member|NULL $member The author of this comment. If NULL, uses currently logged in member.
* @param \IPS\DateTime|NULL $time The time
* @return \IPS\Content\Comment
* @param string|NULL $ipAddress The IP address or NULL to detect automatically
* @param int|NULL $hiddenStatus NULL to set automatically or override: 0 = unhidden; 1 = hidden, pending moderator approval; -1 = hidden (as if hidden by a moderator)
* @return static
*/
public static function create( $item, $comment, $first=FALSE, $guestName=NULL, $incrementPostCount=NULL, $member=NULL, \IPS\DateTime $time=NULL )
public static function create( $item, $comment, $first=FALSE, $guestName=NULL, $incrementPostCount=NULL, $member=NULL, \IPS\DateTime $time=NULL, $ipAddress=NULL, $hiddenStatus=NULL )
{
if ( $member === NULL )
{
@@ -144,11 +146,19 @@ class _Message extends \IPS\Content\Comment implements \IPS\Content\ReportCenter
\IPS\Db::i()->update( 'core_message_topic_user_map', array( 'map_has_unread' => 0, 'map_last_topic_reply' => time(), 'map_read_time' => time() ), array( 'map_topic_id=? AND map_user_id=?', $this->item()->id, $this->author()->member_id ) );
$notification = new \IPS\Notification( \IPS\Application::load('core'), 'new_private_message', $this->item(), array( $this ) );
foreach ( $this->item()->maps( TRUE ) as $map )
$messengerModule = \IPS\Application\Module::get( 'core', 'messaging' );
foreach ( $this->item()->maps() as $map )
{
if ( $map['map_user_id'] !== $this->author()->member_id and $map['map_user_active'] and !$map['map_ignore_notification'] )
{
$member = \IPS\Member::load( $map['map_user_id'] );
/* skip this for members which can't or don't want to use the messenger or for deleted users */
if ( $member->members_disable_pm or !$member->canAccessModule( $messengerModule ) or !$member->member_id )
{
continue;
}
\IPS\core\Messenger\Conversation::rebuildMessageCounts( $member );
$notification->recipients->attach( $member );
@@ -163,4 +173,22 @@ class _Message extends \IPS\Content\Comment implements \IPS\Content\ReportCenter
$notification->send();
}
/**
* Move Comment to another item
*
* @param \IPS\Content\Item $item The item to move this comment too.
* @return void
*/
public function move( \IPS\Content\Item $item )
{
/* Make sure all active participants in the old conversation are in the new one */
$activeParticipants = array_keys( array_filter( $this->item()->maps( TRUE ), function ( $map ) {
return $map['map_user_active'];
} ) );
$item->authorize( $activeParticipants );
parent::move( $item );
}
}