Index: src/XF/Install/Upgrade/2000570-205.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/XF/Install/Upgrade/2000570-205.php (date 1524572546000)
+++ src/XF/Install/Upgrade/2000570-205.php (date 1524572546000)
@@ -0,0 +1,21 @@
+<?php
+
+namespace XF\Install\Upgrade;
+
+use XF\Db\Schema\Alter;
+
+class Version2000570 extends AbstractUpgrade
+{
+ public function getVersionName()
+ {
+ return '2.0.5';
+ }
+
+ public function step1()
+ {
+ $this->schemaManager()->alterTable('xf_user_alert', function(Alter $table)
+ {
+ $table->addColumn('depends_on_addon_id', 'varbinary', 50)->setDefault('');
+ });
+ }
+}
\ No newline at end of file
Index: src/XF/Entity/UserAlert.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/XF/Entity/UserAlert.php (date 1524571883000)
+++ src/XF/Entity/UserAlert.php (date 1524572661000)
@@ -127,7 +127,8 @@
'action' => ['type' => self::STR, 'maxLength' => 30, 'required' => true],
'event_date' => ['type' => self::UINT, 'default' => \XF::$time],
'view_date' => ['type' => self::UINT, 'default' => 0],
- 'extra_data' => ['type' => self::SERIALIZED_ARRAY, 'default' => []]
+ 'extra_data' => ['type' => self::SERIALIZED_ARRAY, 'default' => []],
+ 'depends_on_addon_id' => ['type' => self::BINARY, 'maxLength' => 50, 'default' => '']
];
$structure->getters = [
'Content' => true
@@ -145,6 +146,12 @@
'conditions' =>[['user_id', '=', '$alerted_user_id']],
'primary' => true
],
+ 'AddOn' => [
+ 'entity' => 'XF:AddOn',
+ 'type' => self::TO_ONE,
+ 'conditions' => [['addon_id', '=', '$depends_on_addon_id']],
+ 'primary' => true
+ ]
];
return $structure;
Index: src/XF/Install/Data/MySql.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/XF/Install/Data/MySql.php (date 1524571883000)
+++ src/XF/Install/Data/MySql.php (date 1524572558000)
@@ -1996,6 +1996,7 @@
$table->addColumn('event_date', 'int');
$table->addColumn('view_date', 'int')->setDefault(0)->comment('Time when this was viewed by the alerted user');
$table->addColumn('extra_data', 'mediumblob')->comment('Serialized. Stores any extra data relevant to the alert');
+ $table->addColumn('depends_on_addon_id', 'varbinary', 50)->setDefault('');
$table->addKey(['alerted_user_id', 'event_date'], 'alertedUserId_eventDate');
$table->addKey(['content_type', 'content_id'], 'contentType_contentId');
$table->addKey(['view_date', 'event_date'], 'viewDate_eventDate');
Index: src/XF/Repository/UserAlert.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/XF/Repository/UserAlert.php (date 1524571883000)
+++ src/XF/Repository/UserAlert.php (date 1524572786000)
@@ -17,6 +17,9 @@
{
$finder = $this->finder('XF:UserAlert')
->where('alerted_user_id', $userId)
+ ->whereAddOnActive([
+ 'column' => 'depends_on_addon_id'
+ ])
->order('event_date', 'desc')
->with('User');
@@ -94,6 +97,13 @@
return false;
}
+ $dependsOn = '';
+ if (isset($extra['depends_on_addon_id']))
+ {
+ $dependsOn = $extra['depends_on_addon_id'];
+ unset($extra['depends_on_addon_id']);
+ }
+
$alert = $this->em->create('XF:UserAlert');
$alert->alerted_user_id = $receiverId;
$alert->user_id = $senderId;
@@ -102,6 +112,7 @@
$alert->content_id = $contentId;
$alert->action = $action;
$alert->extra_data = $extra;
+ $alert->depends_on_addon_id = $dependsOn;
$alert->save();
return true;