1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-14 20:54:13 +02:00

[ticket/13713] Introduce mention notifications for groups

PHPBB3-13713
This commit is contained in:
lavigor
2018-07-30 02:58:40 +03:00
committed by Marc Alexander
parent 0fd78c5c87
commit 27b37f3881
6 changed files with 221 additions and 42 deletions

View File

@@ -111,6 +111,8 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
'text_formatter.s9e.mention_helper',
new \phpbb\textformatter\s9e\mention_helper(
$this->db,
$auth,
$this->user,
$phpbb_root_path,
$phpEx
)

View File

@@ -1,5 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<dataset>
<table name="phpbb_groups">
<column>group_id</column>
<column>group_name</column>
<column>group_type</column>
<column>group_desc</column>
<row>
<value>1</value>
<value>Normal group</value>
<value>0</value>
<value></value>
</row>
<row>
<value>2</value>
<value>Hidden group</value>
<value>2</value>
<value></value>
</row>
</table>
<table name="phpbb_notifications">
<column>notification_id</column>
<column>notification_type_id</column>
@@ -89,6 +107,33 @@
<value></value>
<value></value>
</row>
<row>
<value>8</value>
<value>member of normal group</value>
<value></value>
<value></value>
</row>
<row>
<value>9</value>
<value>member of hidden group</value>
<value></value>
<value></value>
</row>
</table>
<table name="phpbb_user_group">
<column>user_id</column>
<column>group_id</column>
<column>user_pending</column>
<row>
<value>8</value>
<value>1</value>
<value>0</value>
</row>
<row>
<value>9</value>
<value>2</value>
<value>0</value>
</row>
</table>
<table name="phpbb_user_notifications">
<column>item_type</column>
@@ -131,5 +176,12 @@
<value>notification.method.board</value>
<value>0</value>
</row>
<row>
<value>notification.type.mention</value>
<value>0</value>
<value>8</value>
<value>notification.method.board</value>
<value>1</value>
</row>
</table>
</dataset>

View File

@@ -139,6 +139,8 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
'text_formatter.s9e.mention_helper',
new \phpbb\textformatter\s9e\mention_helper(
$this->db,
$auth,
$this->user,
$phpbb_root_path,
$phpEx
)

View File

@@ -31,16 +31,20 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio
$this->greaterThan(0))
->will($this->returnValueMap(array(
array(
array(3, 4, 5, 6, 7, 8),
array(3, 4, 5, 6, 7, 8, 10),
'f_read',
1,
array(
1 => array(
'f_read' => array(3, 5, 6, 7),
'f_read' => array(3, 5, 6, 7, 8),
),
),
),
)));
$auth->expects($this->any())
->method('acl_gets')
->with('a_group', 'a_groupadd', 'a_groupdel')
->will($this->returnValue(false));
}
/**
@@ -65,6 +69,7 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio
* 5 => mentioned, but already notified, should STILL receive a new notification
* 6 => mentioned, but option disabled, should NOT receive a notification
* 7 => mentioned, option set to default, should receive a notification
* 8 => mentioned as a member of group 1, should receive a notification
*/
array(
array(
@@ -75,7 +80,9 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio
'[mention=u:5]notified[/mention] already notified, should not receive a new notification',
'[mention=u:6]disabled[/mention] option disabled, should not receive a notification',
'[mention=u:7]default[/mention] option set to default, should receive a notification',
'[mention=u:8]doesn\'t exist[/mention] user does not exist, should not receive a notification',
'[mention=g:1]normal group[/mention] group members of a normal group shoud receive a notification',
'[mention=g:2]hidden group[/mention] group members of a hidden group shoud not receive a notification from a non-member',
'[mention=u:10]doesn\'t exist[/mention] user does not exist, should not receive a notification',
))),
'bbcode_uid' => 'uid',
),
@@ -87,6 +94,7 @@ class phpbb_notification_submit_post_type_mention_test extends phpbb_notificatio
array('user_id' => 5, 'item_id' => 1, 'item_parent_id' => 1),
array('user_id' => 5, 'item_id' => 2, 'item_parent_id' => 1),
array('user_id' => 7, 'item_id' => 2, 'item_parent_id' => 1),
array('user_id' => 8, 'item_id' => 2, 'item_parent_id' => 1),
),
),