Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

+23 -12
View File
@@ -107,9 +107,16 @@ trait Reactable
/* Remove the initial reaction, if we have reacted */
if ( $reacted )
{
$this->removeReaction( $member );
$this->removeReaction( $member, FALSE );
}
/* Give points */
$owner->achievementAction( 'core', 'Reaction', [
'giver' => $member,
'content' => $this,
'reaction' => $reaction
] );
/* Actually insert it */
$idColumn = static::$databaseColumnId;
\IPS\Db::i()->insert( 'core_reputation_index', array(
@@ -150,10 +157,11 @@ trait Reactable
/**
* Remove Reaction
*
* @param \IPS\Member|NULL $member The member, or NULL for currently logged in member
* @param \IPS\Member|NULL $member The member, or NULL for currently logged in member
* @param bool $removeNotifications Whether to remove notifications or not
* @return void
*/
public function removeReaction( \IPS\Member $member = NULL )
public function removeReaction( \IPS\Member $member = NULL, $removeNotifications = TRUE )
{
$member = $member ?: \IPS\Member::loggedIn();
@@ -189,18 +197,21 @@ trait Reactable
}
/* Remove Notifications */
$memberIds = array();
foreach( \IPS\Db::i()->select( '`member`', 'core_notifications', array( 'notification_key=? AND item_class=? AND item_id=?', 'new_likes', (string) \get_class( $this ), (int) $this->$idColumn ) ) as $memberToRecount )
if( $removeNotifications === TRUE )
{
$memberIds[ $memberToRecount ] = $memberToRecount;
}
$memberIds = array();
\IPS\Db::i()->delete( 'core_notifications', array( 'notification_key=? AND item_class=? AND item_id=?', 'new_likes', (string) \get_class( $this ), (int) $this->$idColumn ) );
foreach( \IPS\Db::i()->select( '`member`', 'core_notifications', array( 'notification_key=? AND item_class=? AND item_id=?', 'new_likes', (string) \get_class( $this ), (int) $this->$idColumn ) ) as $memberToRecount )
{
$memberIds[ $memberToRecount ] = $memberToRecount;
}
foreach( $memberIds as $memberToRecount )
{
\IPS\Member::load( $memberToRecount )->recountNotifications();
\IPS\Db::i()->delete( 'core_notifications', array( 'notification_key=? AND item_class=? AND item_id=?', 'new_likes', (string) \get_class( $this ), (int) $this->$idColumn ) );
foreach( $memberIds as $memberToRecount )
{
\IPS\Member::load( $memberToRecount )->recountNotifications();
}
}
}