mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-18 14:48:28 +01:00
Merge pull request #6020 from rxu/ticket/16208
[ticket/16208] Fix posts/PM report notifications
This commit is contained in:
commit
2db4dc8c96
@ -489,6 +489,7 @@ $lang = array_merge($lang, array(
|
|||||||
'NOTIFICATION_REFERENCE' => '"%1$s"',
|
'NOTIFICATION_REFERENCE' => '"%1$s"',
|
||||||
'NOTIFICATION_REASON' => '<em>Reason:</em> %1$s.',
|
'NOTIFICATION_REASON' => '<em>Reason:</em> %1$s.',
|
||||||
'NOTIFICATION_REPORT_PM' => '<strong>Private Message reported</strong> by %1$s:',
|
'NOTIFICATION_REPORT_PM' => '<strong>Private Message reported</strong> by %1$s:',
|
||||||
|
'NOTIFICATION_REPORT_PM_CLOSED' => '<strong>Private Message report closed</strong> by %1$s:',
|
||||||
'NOTIFICATION_REPORT_POST' => '<strong>Post reported</strong> by %1$s:',
|
'NOTIFICATION_REPORT_POST' => '<strong>Post reported</strong> by %1$s:',
|
||||||
'NOTIFICATION_REPORT_CLOSED' => '<strong>Report closed</strong> by %1$s for:',
|
'NOTIFICATION_REPORT_CLOSED' => '<strong>Report closed</strong> by %1$s for:',
|
||||||
'NOTIFICATION_TOPIC' => '<strong>New topic</strong> by %1$s:',
|
'NOTIFICATION_TOPIC' => '<strong>New topic</strong> by %1$s:',
|
||||||
|
@ -2,6 +2,12 @@ Subject: Report closed - "{POST_SUBJECT}"
|
|||||||
|
|
||||||
Hello {USERNAME},
|
Hello {USERNAME},
|
||||||
|
|
||||||
You are receiving this notification because the report you filed on the post "{POST_SUBJECT}" in "{TOPIC_TITLE}" at "{SITENAME}" was handled by a moderator or by an administrator. The report was afterwards closed. If you have further questions contact {CLOSER_NAME} with a personal message.
|
You are receiving this notification because the report you filed on the post "{POST_SUBJECT}" by "{AUTHOR_NAME}" in "{TOPIC_TITLE}" at "{SITENAME}" was handled by a moderator or by an administrator. The report was afterwards closed. If you have further questions contact {CLOSER_NAME} with a personal message.
|
||||||
|
|
||||||
|
You can view your reported post by clicking on the following link:
|
||||||
|
|
||||||
|
{U_VIEW_POST}
|
||||||
|
|
||||||
|
You have requested that you be notified on this event, remember that you can always choose not to be notified of closed post reports by changing the appropriate setting in your profile.
|
||||||
|
|
||||||
{EMAIL_SIG}
|
{EMAIL_SIG}
|
||||||
|
13
phpBB/language/en/email/report_pm_closed.txt
Normal file
13
phpBB/language/en/email/report_pm_closed.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Subject: Private message report closed - "{SUBJECT}"
|
||||||
|
|
||||||
|
Hello {USERNAME},
|
||||||
|
|
||||||
|
You are receiving this notification because the report you filed on the private message "{SUBJECT}" by "{AUTHOR_NAME}" at "{SITENAME}" was handled by a moderator or by an administrator. The report was afterwards closed. If you have further questions contact {CLOSER_NAME} with a personal message.
|
||||||
|
|
||||||
|
You can view your reported private message by clicking on the following link:
|
||||||
|
|
||||||
|
{U_VIEW_MESSAGE}
|
||||||
|
|
||||||
|
You have requested that you be notified on this event, remember that you can always choose not to be notified of closed private message reports by changing the appropriate setting in your profile.
|
||||||
|
|
||||||
|
{EMAIL_SIG}
|
@ -343,6 +343,9 @@ $lang = array_merge($lang, array(
|
|||||||
'NOTIFICATION_TYPE_POST' => 'Someone replies to a topic to which you are subscribed',
|
'NOTIFICATION_TYPE_POST' => 'Someone replies to a topic to which you are subscribed',
|
||||||
'NOTIFICATION_TYPE_QUOTE' => 'Someone quotes you in a post',
|
'NOTIFICATION_TYPE_QUOTE' => 'Someone quotes you in a post',
|
||||||
'NOTIFICATION_TYPE_REPORT' => 'Someone reports a post',
|
'NOTIFICATION_TYPE_REPORT' => 'Someone reports a post',
|
||||||
|
'NOTIFICATION_TYPE_REPORT_CLOSED' => 'Your report on a post is closed by a moderator',
|
||||||
|
'NOTIFICATION_TYPE_REPORT_PM' => 'Someone reports a private message',
|
||||||
|
'NOTIFICATION_TYPE_REPORT_PM_CLOSED' => 'Your report on a private message is closed by a moderator',
|
||||||
'NOTIFICATION_TYPE_TOPIC' => 'Someone creates a topic in a forum to which you are subscribed',
|
'NOTIFICATION_TYPE_TOPIC' => 'Someone creates a topic in a forum to which you are subscribed',
|
||||||
'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER' => 'User requiring activation',
|
'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER' => 'User requiring activation',
|
||||||
|
|
||||||
|
@ -60,11 +60,11 @@ class report_pm extends \phpbb\notification\type\pm
|
|||||||
* @var bool|array False if the service should use it's default data
|
* @var bool|array False if the service should use it's default data
|
||||||
* Array of data (including keys 'id', 'lang', and 'group')
|
* Array of data (including keys 'id', 'lang', and 'group')
|
||||||
*/
|
*/
|
||||||
static public $notification_option = array(
|
static public $notification_option = [
|
||||||
'id' => 'notification.type.report',
|
'id' => 'notification.type.report_pm',
|
||||||
'lang' => 'NOTIFICATION_TYPE_REPORT',
|
'lang' => 'NOTIFICATION_TYPE_REPORT_PM',
|
||||||
'group' => 'NOTIFICATION_GROUP_MODERATION',
|
'group' => 'NOTIFICATION_GROUP_MODERATION',
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the id of the parent
|
* Get the id of the parent
|
||||||
@ -84,12 +84,10 @@ class report_pm extends \phpbb\notification\type\pm
|
|||||||
*/
|
*/
|
||||||
public function is_available()
|
public function is_available()
|
||||||
{
|
{
|
||||||
$m_approve = $this->auth->acl_getf($this->permission, true);
|
return $this->config['allow_pm_report'] &&
|
||||||
|
!empty($this->auth->acl_get($this->permission));
|
||||||
return (!empty($m_approve));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the users who want to receive notifications
|
* Find the users who want to receive notifications
|
||||||
* (copied from post_in_queue)
|
* (copied from post_in_queue)
|
||||||
@ -99,11 +97,11 @@ class report_pm extends \phpbb\notification\type\pm
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function find_users_for_notification($post, $options = array())
|
public function find_users_for_notification($post, $options = [])
|
||||||
{
|
{
|
||||||
$options = array_merge(array(
|
$options = array_merge([
|
||||||
'ignore_users' => array(),
|
'ignore_users' => [],
|
||||||
), $options);
|
], $options);
|
||||||
|
|
||||||
// Global
|
// Global
|
||||||
$post['forum_id'] = 0;
|
$post['forum_id'] = 0;
|
||||||
@ -112,7 +110,7 @@ class report_pm extends \phpbb\notification\type\pm
|
|||||||
|
|
||||||
if (empty($auth_approve))
|
if (empty($auth_approve))
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($key = array_search($this->user->data['user_id'], $auth_approve[$post['forum_id']][$this->permission])))
|
if (($key = array_search($this->user->data['user_id'], $auth_approve[$post['forum_id']][$this->permission])))
|
||||||
@ -120,9 +118,9 @@ class report_pm extends \phpbb\notification\type\pm
|
|||||||
unset($auth_approve[$post['forum_id']][$this->permission][$key]);
|
unset($auth_approve[$post['forum_id']][$this->permission][$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->check_user_notification_options($auth_approve[$post['forum_id']][$this->permission], array_merge($options, array(
|
return $this->check_user_notification_options($auth_approve[$post['forum_id']][$this->permission], array_merge($options, [
|
||||||
'item_type' => static::$notification_option['id'],
|
'item_type' => static::$notification_option['id'],
|
||||||
)));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,7 +142,7 @@ class report_pm extends \phpbb\notification\type\pm
|
|||||||
{
|
{
|
||||||
$user_data = $this->user_loader->get_user($this->get_data('from_user_id'));
|
$user_data = $this->user_loader->get_user($this->get_data('from_user_id'));
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']),
|
'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']),
|
||||||
'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))),
|
'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))),
|
||||||
|
|
||||||
@ -152,7 +150,7 @@ class report_pm extends \phpbb\notification\type\pm
|
|||||||
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))),
|
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))),
|
||||||
|
|
||||||
'U_VIEW_REPORT' => generate_board_url() . "/mcp.{$this->php_ext}?r={$this->item_parent_id}&i=pm_reports&mode=pm_report_details",
|
'U_VIEW_REPORT' => generate_board_url() . "/mcp.{$this->php_ext}?r={$this->item_parent_id}&i=pm_reports&mode=pm_report_details",
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,15 +237,16 @@ class report_pm extends \phpbb\notification\type\pm
|
|||||||
*/
|
*/
|
||||||
public function users_to_query()
|
public function users_to_query()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
$this->get_data('from_user_id'),
|
$this->get_data('from_user_id'),
|
||||||
$this->get_data('reporter_id'),
|
$this->get_data('reporter_id'),
|
||||||
); }
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function create_insert_array($post, $pre_create_data = array())
|
public function create_insert_array($post, $pre_create_data = [])
|
||||||
{
|
{
|
||||||
$this->set_data('reporter_id', $this->user->data['user_id']);
|
$this->set_data('reporter_id', $this->user->data['user_id']);
|
||||||
$this->set_data('reason_title', strtoupper($post['reason_title']));
|
$this->set_data('reason_title', strtoupper($post['reason_title']));
|
||||||
|
@ -35,18 +35,30 @@ class report_pm_closed extends \phpbb\notification\type\pm
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $email_template = '';
|
public $email_template = 'report_pm_closed';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language key used to output the text
|
* Language key used to output the text
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $language_key = 'NOTIFICATION_REPORT_CLOSED';
|
protected $language_key = 'NOTIFICATION_REPORT_PM_CLOSED';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification option data (for outputting to the user)
|
||||||
|
*
|
||||||
|
* @var bool|array False if the service should use it's default data
|
||||||
|
* Array of data (including keys 'id', 'lang', and 'group')
|
||||||
|
*/
|
||||||
|
static public $notification_option = [
|
||||||
|
'id' => 'notification.type.report_pm_closed',
|
||||||
|
'lang' => 'NOTIFICATION_TYPE_REPORT_PM_CLOSED',
|
||||||
|
'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS',
|
||||||
|
];
|
||||||
|
|
||||||
public function is_available()
|
public function is_available()
|
||||||
{
|
{
|
||||||
return false;
|
return (bool) $this->config['allow_pm_report'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,14 +69,18 @@ class report_pm_closed extends \phpbb\notification\type\pm
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function find_users_for_notification($pm, $options = array())
|
public function find_users_for_notification($pm, $options = [])
|
||||||
{
|
{
|
||||||
|
$options = array_merge([
|
||||||
|
'ignore_users' => [],
|
||||||
|
], $options);
|
||||||
|
|
||||||
if ($pm['reporter'] == $this->user->data['user_id'])
|
if ($pm['reporter'] == $this->user->data['user_id'])
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($pm['reporter'] => $this->notification_manager->get_default_methods());
|
return $this->check_user_notification_options([$pm['reporter']], $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +90,7 @@ class report_pm_closed extends \phpbb\notification\type\pm
|
|||||||
*/
|
*/
|
||||||
public function get_email_template()
|
public function get_email_template()
|
||||||
{
|
{
|
||||||
return false;
|
return $this->email_template;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,17 +100,16 @@ class report_pm_closed extends \phpbb\notification\type\pm
|
|||||||
*/
|
*/
|
||||||
public function get_email_template_variables()
|
public function get_email_template_variables()
|
||||||
{
|
{
|
||||||
return array();
|
$sender_data = $this->user_loader->get_username($this->get_data('from_user_id'), 'username');
|
||||||
}
|
$closer_data = $this->user_loader->get_username($this->get_data('closer_id'), 'username');
|
||||||
|
|
||||||
/**
|
return [
|
||||||
* Get the url to this item
|
'AUTHOR_NAME' => htmlspecialchars_decode($sender_data['username']),
|
||||||
*
|
'CLOSER_NAME' => htmlspecialchars_decode($closer_data['username']),
|
||||||
* @return string URL
|
'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))),
|
||||||
*/
|
|
||||||
public function get_url()
|
'U_VIEW_MESSAGE'=> generate_board_url() . "/ucp.{$this->php_ext}?i=pm&mode=view&p={$this->item_id}",
|
||||||
{
|
];
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,13 +155,13 @@ class report_pm_closed extends \phpbb\notification\type\pm
|
|||||||
*/
|
*/
|
||||||
public function users_to_query()
|
public function users_to_query()
|
||||||
{
|
{
|
||||||
return array($this->get_data('closer_id'));
|
return [$this->get_data('closer_id')];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function create_insert_array($pm, $pre_create_data = array())
|
public function create_insert_array($pm, $pre_create_data = [])
|
||||||
{
|
{
|
||||||
$this->set_data('closer_id', $pm['closer_id']);
|
$this->set_data('closer_id', $pm['closer_id']);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class report_post_closed extends \phpbb\notification\type\post
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $email_template = '';
|
public $email_template = 'report_closed';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language key used to output the text
|
* Language key used to output the text
|
||||||
@ -44,6 +44,18 @@ class report_post_closed extends \phpbb\notification\type\post
|
|||||||
*/
|
*/
|
||||||
protected $language_key = 'NOTIFICATION_REPORT_CLOSED';
|
protected $language_key = 'NOTIFICATION_REPORT_CLOSED';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification option data (for outputting to the user)
|
||||||
|
*
|
||||||
|
* @var bool|array False if the service should use it's default data
|
||||||
|
* Array of data (including keys 'id', 'lang', and 'group')
|
||||||
|
*/
|
||||||
|
static public $notification_option = [
|
||||||
|
'id' => 'notification.type.report_post_closed',
|
||||||
|
'lang' => 'NOTIFICATION_TYPE_REPORT_CLOSED',
|
||||||
|
'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inherit notification read status from post.
|
* Inherit notification read status from post.
|
||||||
*
|
*
|
||||||
@ -53,7 +65,7 @@ class report_post_closed extends \phpbb\notification\type\post
|
|||||||
|
|
||||||
public function is_available()
|
public function is_available()
|
||||||
{
|
{
|
||||||
return false;
|
return $this->auth->acl_getf_global('f_report');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,14 +76,18 @@ class report_post_closed extends \phpbb\notification\type\post
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function find_users_for_notification($post, $options = array())
|
public function find_users_for_notification($post, $options = [])
|
||||||
{
|
{
|
||||||
|
$options = array_merge([
|
||||||
|
'ignore_users' => [],
|
||||||
|
], $options);
|
||||||
|
|
||||||
if ($post['reporter'] == $this->user->data['user_id'])
|
if ($post['reporter'] == $this->user->data['user_id'])
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($post['reporter'] => $this->notification_manager->get_default_methods());
|
return $this->check_user_notification_options([$post['reporter']], $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,7 +97,7 @@ class report_post_closed extends \phpbb\notification\type\post
|
|||||||
*/
|
*/
|
||||||
public function get_email_template()
|
public function get_email_template()
|
||||||
{
|
{
|
||||||
return false;
|
return $this->email_template;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,7 +107,17 @@ class report_post_closed extends \phpbb\notification\type\post
|
|||||||
*/
|
*/
|
||||||
public function get_email_template_variables()
|
public function get_email_template_variables()
|
||||||
{
|
{
|
||||||
return array();
|
$post_username = $this->get_data('post_username') ?: $this->user_loader->get_username($this->get_data('poster_id'), 'username');
|
||||||
|
$closer_username = $this->user_loader->get_username($this->get_data('closer_id'), 'username');
|
||||||
|
|
||||||
|
return [
|
||||||
|
'AUTHOR_NAME' => htmlspecialchars_decode($post_username),
|
||||||
|
'CLOSER_NAME' => htmlspecialchars_decode($closer_username),
|
||||||
|
'POST_SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('post_subject'))),
|
||||||
|
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))),
|
||||||
|
|
||||||
|
'U_VIEW_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?p={$this->item_id}#p{$this->item_id}",
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,7 +127,15 @@ class report_post_closed extends \phpbb\notification\type\post
|
|||||||
*/
|
*/
|
||||||
public function get_url()
|
public function get_url()
|
||||||
{
|
{
|
||||||
return '';
|
return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "p={$this->item_id}#p{$this->item_id}");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {inheritDoc}
|
||||||
|
*/
|
||||||
|
public function get_redirect_url()
|
||||||
|
{
|
||||||
|
return $this->get_url();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,13 +181,13 @@ class report_post_closed extends \phpbb\notification\type\post
|
|||||||
*/
|
*/
|
||||||
public function users_to_query()
|
public function users_to_query()
|
||||||
{
|
{
|
||||||
return array($this->get_data('closer_id'));
|
return [$this->get_data('closer_id')];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function create_insert_array($post, $pre_create_data = array())
|
public function create_insert_array($post, $pre_create_data = [])
|
||||||
{
|
{
|
||||||
$this->set_data('closer_id', $post['closer_id']);
|
$this->set_data('closer_id', $post['closer_id']);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user