mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11103] Use report text for report notification, never notify reporter
PHPBB3-11103
This commit is contained in:
parent
3557b39115
commit
3839fe6902
3 changed files with 45 additions and 2 deletions
|
@ -115,7 +115,8 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
|||
$sql = 'SELECT *
|
||||
FROM ' . USER_NOTIFICATIONS_TABLE . "
|
||||
WHERE item_type = '" . self::$notification_option['id'] . "'
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_approve[$post['forum_id']][$this->permission]);
|
||||
AND " . $this->db->sql_in_set('user_id', $auth_approve[$post['forum_id']][$this->permission]) . '
|
||||
AND user_id <> ' . $this->user->data['user_id'];
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
|
@ -174,6 +175,16 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
|||
|
||||
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
|
||||
|
||||
if ($this->get_data('report_text'))
|
||||
{
|
||||
return $this->user->lang(
|
||||
$this->language_key,
|
||||
$username,
|
||||
censor_text($this->get_data('message_subject')),
|
||||
$this->get_data('report_text')
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($this->user->lang[$this->get_data('reason_title')]))
|
||||
{
|
||||
return $this->user->lang(
|
||||
|
@ -224,6 +235,7 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
|||
$this->set_data('reporter_id', $this->user->data['user_id']);
|
||||
$this->set_data('reason_title', strtoupper($post['reason_title']));
|
||||
$this->set_data('reason_description', $post['reason_description']);
|
||||
$this->set_data('report_text', $post['report_text']);
|
||||
|
||||
return parent::create_insert_array($post, $pre_create_data);
|
||||
}
|
||||
|
|
|
@ -65,6 +65,23 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
|
|||
return 'report_post';
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the users who want to receive notifications
|
||||
*
|
||||
* @param array $post Data from the post
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function find_users_for_notification($post, $options = array())
|
||||
{
|
||||
$notify_users = parent::find_users_for_notification($post, $options);
|
||||
|
||||
// never notify reporter
|
||||
unset($notify_users[$this->user->data['user_id']]);
|
||||
|
||||
return $notify_users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get email template variables
|
||||
*
|
||||
|
@ -110,6 +127,16 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
|
|||
|
||||
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
|
||||
|
||||
if ($this->get_data('report_text'))
|
||||
{
|
||||
return $this->user->lang(
|
||||
$this->language_key,
|
||||
$username,
|
||||
censor_text($this->get_data('post_subject')),
|
||||
$this->get_data('report_text')
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($this->user->lang[$this->get_data('reason_title')]))
|
||||
{
|
||||
return $this->user->lang(
|
||||
|
@ -160,6 +187,7 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
|
|||
$this->set_data('reporter_id', $this->user->data['user_id']);
|
||||
$this->set_data('reason_title', strtoupper($post['reason_title']));
|
||||
$this->set_data('reason_description', $post['reason_description']);
|
||||
$this->set_data('report_text', $post['report_text']);
|
||||
|
||||
return parent::create_insert_array($post, $pre_create_data);
|
||||
}
|
||||
|
|
|
@ -186,7 +186,9 @@ if ($submit && $reason_id)
|
|||
$lang_success = $user->lang['POST_REPORTED_SUCCESS'];
|
||||
|
||||
// Notify relevant users
|
||||
$phpbb_notifications->add_notifications('report_post', array_merge($report_data, $row, $forum_data));
|
||||
$phpbb_notifications->add_notifications('report_post', array_merge($report_data, $row, $forum_data, array(
|
||||
'report_text' => $report_text,
|
||||
)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -216,6 +218,7 @@ if ($submit && $reason_id)
|
|||
|
||||
// Notify relevant users
|
||||
$phpbb_notifications->add_notifications('report_pm', array_merge($report_data, $row, array(
|
||||
'report_text' => $report_text,
|
||||
'from_user_id' => $report_data['author_id'],
|
||||
'report_id' => $report_id,
|
||||
)));
|
||||
|
|
Loading…
Add table
Reference in a new issue