Skip to content

Commit 8554876

Browse files
committed
Use a notification custom identifier
Signed-off-by: Matt Friedman <maf675@gmail.com>
1 parent d8619ca commit 8554876

3 files changed

Lines changed: 39 additions & 1 deletion

File tree

factory/idea.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ public function set_status($idea_id, $status)
7171

7272
$this->update_idea_data($sql_ary, $idea_id, $this->table_ideas);
7373

74+
// Send a notification
75+
// Increment our notifications sent counter
76+
$this->config->increment('ideas_status_notifications_id', 1);
7477
$this->notification_manager->add_notifications('phpbb.ideas.notification.type.status', [
78+
'item_id' => $this->config['ideas_status_notifications_id'],
7579
'idea_id' => (int) $idea_id,
7680
'status' => (int) $status,
7781
]);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
*
4+
* Ideas extension for the phpBB Forum Software package.
5+
*
6+
* @copyright (c) phpBB Limited <https://www.phpbb.com>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
11+
namespace phpbb\ideas\migrations;
12+
13+
class m14_notification_data extends \phpbb\db\migration\migration
14+
{
15+
public function effectively_installed()
16+
{
17+
return $this->config->offsetExists('ideas_status_notifications_id');
18+
}
19+
20+
public static function depends_on()
21+
{
22+
return [
23+
'\phpbb\ideas\migrations\m1_initial_schema',
24+
'\phpbb\ideas\migrations\m13_set_permissions'
25+
];
26+
}
27+
28+
public function update_data()
29+
{
30+
return [
31+
['config.add', ['ideas_status_notifications_id', 0, true]],
32+
];
33+
}
34+
}

notification/type/status.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function is_available()
109109
*/
110110
public static function get_item_id($type_data)
111111
{
112-
return (int) ($type_data['idea_id'] . $type_data['status']);
112+
return (int) $type_data['item_id'];
113113
}
114114

115115
/**

0 commit comments

Comments
 (0)