Version 5.0.0 beta 6
This commit is contained in:
1 parent
57d9db6ce2
commit
fa2a720105
115 files changed
+1823
-1147
No files matched your search
@@ -1257,11 +1257,18 @@ abstract class Content extends ActiveRecord
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* How many followers? */
|
||||
try
|
||||
{
|
||||
$count = $this->notificationRecipients( NULL, TRUE );
|
||||
if( $this instanceof Comment )
|
||||
{
|
||||
$count = $this->item()->notificationRecipientsForComments( null, true, $this );
|
||||
}
|
||||
else
|
||||
{
|
||||
$count = $this->notificationRecipients( NULL, TRUE );
|
||||
}
|
||||
}
|
||||
catch ( BadMethodCallException $e )
|
||||
{
|
||||
@@ -1290,7 +1297,8 @@ abstract class Content extends ActiveRecord
|
||||
*/
|
||||
public function sendNotificationsBatch( int $offset=0, array &$sentTo=array(), string|null $extra=NULL ): int|NULL
|
||||
{
|
||||
if( !IPS::classUsesTrait( $this, Followable::class ) )
|
||||
/* Stop here if the content does not use the "followable" trait */
|
||||
if( ( $this instanceof Item and !IPS::classUsesTrait( $this, Followable::class ) ) or ( $this instanceof Comment and !IPS::classUsesTrait( $this->item(), Followable::class ) ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -1303,7 +1311,9 @@ abstract class Content extends ActiveRecord
|
||||
}
|
||||
|
||||
$followIds = array();
|
||||
$followers = $this->notificationRecipients( array( $offset, static::NOTIFICATIONS_PER_BATCH ) );
|
||||
$followers = ( $this instanceof Comment ) ?
|
||||
$this->item()->notificationRecipientsForComments( array( $offset, static::NOTIFICATIONS_PER_BATCH ), false, $this ) :
|
||||
$this->notificationRecipients( array( $offset, static::NOTIFICATIONS_PER_BATCH ) );
|
||||
|
||||
/* If $followers is NULL (which can be the case if the follows are just people following the author), just return as there is nothing to do */
|
||||
if ( $followers === NULL )
|
||||
@@ -1320,7 +1330,7 @@ abstract class Content extends ActiveRecord
|
||||
}
|
||||
|
||||
/* Send notification */
|
||||
$notification = $this->createNotification( $extra );
|
||||
$notification = ( $this instanceof Comment ) ? $this->item()->createNotification( $extra, $this ) : $this->createNotification( $extra );
|
||||
$notification->unsubscribeType = 'follow';
|
||||
foreach ( $followers as $follower )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user