Skip to content

Commit b8a0aa4

Browse files
authored
Merge pull request #8 from rbonick/master
Adds reputation comments to the notifications themselves
2 parents fabd52d + 40f0cd1 commit b8a0aa4

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

controller/rating_controller.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config
103103
/**
104104
* Display the post rating page
105105
*
106-
* @param string $mode Mode taken from the URL
106+
* @param string $mode Mode taken from the URL
107107
* @param int $post_id Post ID taken from the URL
108108
* @return Symfony\Component\HttpFoundation\Response A Symfony Response object
109109
* @access public
@@ -434,7 +434,7 @@ public function post($mode, $post_id)
434434
// Save vote
435435
if ($submit)
436436
{
437-
// Prevent cheater to break the forum permissions to give negative points or give more points than they can
437+
// Prevent cheater to break the forum permissions to give negative points or give more points than they can
438438
if (!$this->auth->acl_get('f_rs_rate_negative', $row['forum_id']) && $points < 0 || $points < 0 && $this->config['rs_min_rep_negative'] && ($this->user->data['user_reputation'] < $this->config['rs_min_rep_negative']) || $this->config['rs_enable_power'] && (($points > $max_voting_allowed) || ($points < -$max_voting_allowed)))
439439
{
440440
$submit = false;
@@ -483,6 +483,7 @@ public function post($mode, $post_id)
483483
'user_id_from' => $this->user->data['user_id'],
484484
'post_id' => $post_id,
485485
'post_subject' => $row['post_subject'],
486+
'comment' => $comment,
486487
);
487488

488489
$notification_type = ($points > 0) ? 'pico.reputation.notification.type.rate_post_positive' : 'pico.reputation.notification.type.rate_post_negative';
@@ -825,7 +826,7 @@ public function user($uid)
825826

826827
if ($submit)
827828
{
828-
//Prevent cheater to break the forum permissions to give negative points or give more points than they can
829+
//Prevent cheater to break the forum permissions to give negative points or give more points than they can
829830
if (!$this->auth->acl_get('u_rs_rate_negative') && $points < 0 || $points < 0 && $this->config['rs_min_rep_negative'] && ($this->user->data['user_reputation'] < $this->config['rs_min_rep_negative']) || $this->config['rs_enable_power'] && (($points > $max_voting_allowed) || ($points < -$max_voting_allowed)))
830831
{
831832
$submit = false;
@@ -898,4 +899,4 @@ public function user($uid)
898899

899900
return $this->helper->render('rateuser.html', $this->user->lang('RS_USER_RATING'));
900901
}
901-
}
902+
}

language/en/reputation_common.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
'RS_VIEW_DETAILS' => 'View details',
5454

5555
'NOTIFICATION_TYPE_REPUTATION' => 'Someone gives you reputation point',
56-
'NOTIFICATION_RATE_POST_POSITIVE' => '<strong>Rated positively</strong> by %s for post',
57-
'NOTIFICATION_RATE_POST_NEGATIVE' => '<strong>Rated negatively</strong> by %s for post',
56+
'NOTIFICATION_RATE_POST_POSITIVE' => '<strong>Rated positively</strong> by %s for post %s',
57+
'NOTIFICATION_RATE_POST_NEGATIVE' => '<strong>Rated negatively</strong> by %s for post %s',
5858
'NOTIFICATION_RATE_USER' => '<strong>Rated</strong> by %s',
5959
));

notification/type/rate_post_positive.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ public function get_title()
228228
return $this->user->lang(
229229
$this->language_key,
230230
phpbb_generate_string_list($usernames, $this->user),
231+
censor_text($this->get_data('post_subject')),
231232
$trimmed_voting_users_cnt
232233
);
233234
}
@@ -239,9 +240,12 @@ public function get_title()
239240
*/
240241
public function get_reference()
241242
{
243+
if (empty($this->get_data('comment'))) {
244+
return null;
245+
}
242246
return $this->user->lang(
243247
'NOTIFICATION_REFERENCE',
244-
censor_text($this->get_data('post_subject'))
248+
censor_text($this->get_data('comment'))
245249
);
246250
}
247251

@@ -305,6 +309,7 @@ public function create_insert_array($data, $pre_create_data = array())
305309
$this->set_data('user_id_from', $data['user_id_from']);
306310
$this->set_data('post_id', $data['post_id']);
307311
$this->set_data('post_subject', $data['post_subject']);
312+
$this->set_data('comment', $data['comment']);
308313

309314
parent::create_insert_array($data, $pre_create_data);
310315
}

0 commit comments

Comments
 (0)