Skip to content
Permalink
Browse files

* fixed feedback replies so only the related parties can see the rep…

…ly to feedback button

        * added view and post feedback user permissions
        * redesigned how private comments are displayed on the Trader Feedback page
        * fixed bugs where reporting trader feedback wasn't working properly
        * last editor of a feedback is now shown in the edit history
        * fixed behaviour/crashes in the MCP where report details tabs were being shown incorrectly
        * closing and deleting feedback reports now correctly mimics phpBB behaviour
        * closing/deleting feedback reports in the MCP now shows up in the moderator log
        * when creating a topic in a forum with only one BST option, the option is now shown
  • Loading branch information
rfdy committed Jan 27, 2015
1 parent 4bf4667 commit fb1f2ca2076b66132d502d56cc26cd7a9af6bb13
@@ -1,9 +1,19 @@
August 7, 2014
* 0.0.1 (2015-xx-xx)

Changed the logic so that the rating given to other users is the summations of all feedback, where if User A has given User B more +1 Feedbacks than -1 Feedbacks, then User A will rate B positively. More -1 Feedbacks than +1 Feedbacks will result in a negative rating.
* 2015-01-19
* fixed feedback replies so only the related parties can see the reply to feedback button
* added view and post feedback user permissions
* redesigned how private comments are displayed on the Trader Feedback page
* fixed bugs where reporting trader feedback wasn't working properly
* last editor of a feedback is now shown in the edit history
* fixed behaviour/crashes in the MCP where report details tabs were being shown incorrectly
* closing and deleting feedback reports now correctly mimics phpBB behaviour
* closing/deleting feedback reports in the MCP now shows up in the moderator log
* when creating a topic in a forum with only one BST option, the option is now shown

Added configuration option on ACP to set what kind of trades are permitted on per forum basis

August 11, 2014

Updated feedback image
* 2014-08-11
* updated feedback image

* 2014-08-07
* changed the logic so that the rating given to other users is the summations of all feedback
* added configuration option on ACP to set what kind of trades are permitted on per forum basis

Large diffs are not rendered by default.

@@ -2,6 +2,7 @@
namespace rfd\trader\Event;
use rfd\trader\Service\RatingsManager;
use Symfony\Component\EventDispatcher\EventSubscriberInterface,
phpbb\event\data as phpbbEvent,
phpbb\user as phpbbUser,
@@ -36,6 +37,7 @@ class TraderListener implements EventSubscriberInterface {
protected $manager;
private $phpbb_root_path, $phpEx;
/**
* This flag is set at runtime, where the order of events really matters.
*
@@ -75,6 +77,13 @@ static public function getSubscribedEvents() {
'core.viewtopic_modify_post_row' => 'viewtopic_modify_post_row',
'core.memberlist_prepare_profile_data' => 'memberlist_prepare_profile_data',
'core.viewtopic_get_post_data' => 'viewtopic_get_post_data',
'core.modify_mcp_modules_display_option' => 'modify_mcp_modules_display_option',
// API events
'rfd.api.get_forum' => 'rfd_api_get_forum',
//'rfd.api.get_user' => 'rfd_api_get_user',
'rfd.api.get_topic' => 'rfd_api_get_topic'
);
}
@@ -90,8 +99,12 @@ public function add_permissions($event)
// Add permissions for infractions
$permissions = $data['permissions'];
$permissions['a_trader'] = array('lang' => 'ACL_A_TRADER', 'cat' => 'misc');
$permissions['m_feedback_edit'] = array('lang' => 'ACL_M_FEEDBACK_EDIT', 'cat' => 'trader');
$permissions[RatingsManager::A_TRADER] = array('lang' => 'ACL_A_TRADER', 'cat' => 'misc');
$permissions[RatingsManager::M_TRADER_EDIT] = array('lang' => 'ACL_M_TRADER_EDIT', 'cat' => 'trader');
// Add permissions for viewing and leaving feedback
$permissions[RatingsManager::U_TRADER_VIEW] = array('lang' => 'ACL_U_TRADER_VIEW', 'cat' => 'misc');
$permissions[RatingsManager::U_TRADER_POST] = array('lang' => 'ACL_U_TRADER_POST', 'cat' => 'misc');
$data['permissions'] = $permissions;
@@ -190,12 +203,14 @@ public function viewtopic_modify_post_row(phpbbEvent $event) {
return false;
}
$feedback_url = $this->helper->route('rfd_trader_feedback', array(
'topic_id' => $data['row']['topic_id'],
));
$data['post_row']['U_GIVE_FEEDBACK'] = $feedback_url;
// Set U_GIVE_FEEDBACK variable iff user has leave feedback permission
if($this->manager->hasLeaveFeedbackPermission()) {
$data['post_row']['U_GIVE_FEEDBACK'] = $feedback_url;
}
$view_feedback_url = $this->helper->route('rfd_trader_view', array(
'u' => $data['row']['user_id'],
@@ -225,8 +240,6 @@ public function viewtopic_modify_post_row(phpbbEvent $event) {
public function viewforum_modify_topicrow(phpbbEvent $event) {
global $forum_data;
if ($forum_data['enabled_trader_types']) { // only set the trader type if trader is enabled
$data = $event->get_data();
@@ -343,6 +356,8 @@ public function modify_posting_parameters(phpbbEvent $event) {
* @return bool
*/
public function memberlist_prepare_profile_data(phpbbEvent $event) {
global $template;
$data = $event->get_data();
$view_feedback_url = $this->helper->route('rfd_trader_view', array(
@@ -355,6 +370,9 @@ public function memberlist_prepare_profile_data(phpbbEvent $event) {
$data['template_data']['TRADER_RATING'] = $positive - $negative;
$data['template_data']['TRADER_PERCENTAGE'] = $this->manager->getPositivePercent($positive, $negative);
// Set view feedback permission
$template->assign_var('TRADER_HAS_VIEW_FEEDBACK_PERMISSION', $this->manager->hasViewFeedbackPermission());
$event->set_data($data);
}
@@ -363,5 +381,63 @@ public function viewtopic_get_post_data(phpbbEvent $event) {
$data = $event->get_data();
$template->assign_var('TOPIC_TRADER_TYPE', $data['topic_data']['topic_trader_type']);
// Set view feedback permission
$template->assign_var('TRADER_HAS_VIEW_FEEDBACK_PERMISSION', $this->manager->hasViewFeedbackPermission());
}
/**
* Add trader status to the forum data
* @param phpbbEvent $event
*/
public function rfd_api_get_forum(phpbbEvent $event)
{
$data = $event->get_data();
$forum = $data['forum'];
$raw_forum = $data['raw_forum'];
$forum['trader_status'] = $this->manager->getTraderStatusString($raw_forum['enabled_trader_types']);
$data['forum'] = $forum;
$event->set_data($data);
}
/**
* Hide the trader report details module from the MCP sidebar by default
*
* @param phpbbEvent $event
*/
public function modify_mcp_modules_display_option(phpbbEvent $event) {
global $module;
$module->set_display('\rfd\trader\mcp\mcp_trader_module', 'trader_report_details', false);
}
public function rfd_api_get_user(phpbbEvent $event){
$data = $event->get_data();
$user = $data['user'];
$raw_user = $data['raw_user'];
$user['trader_positive'] = (int) $raw_user['user_trader_positive'];
$user['trader_neutral'] = (int) $raw_user['user_trader_neutral'];
$user['trader_negative'] = (int) $raw_user['user_trader_negative'];
$data['user'] = $user;
$event->set_data($data);
}
public function rfd_api_get_topic(phpbbEvent $event){
$data = $event->get_data();
$topic = $data['topic'];
$raw_topic = $data['raw_topic'];
$topic['trader_type'] = $raw_topic['topic_trader_type'];
$data['topic'] = $topic;
$event->set_data($data);
}
}
@@ -2,7 +2,6 @@ Trader
======
Trader extension for phpBB 3.1 - a rating system for Buy, Sell and Trade forums


Enabling Trader on Forums:
--------------------------
Before everything, you need to enable the Trader extension in the Administrator Control Panel (Manage Extensions page).
@@ -18,14 +17,32 @@ Buy or Sell topics.
- It is HIGHLY RECOMMENDED to enable Trader options only on forums which DO NOT have existing posts
This is because the topic's Trader type is used for displaying information on Trader pages)



Feedback System
---------------
With the trader feedback system, a user can rate other users either positively (+1), neutrally (0) or negatively (-1).
The rating given to other users is the summations of all feedback. A user can only give 1 feedback per topic in
forums where the Trader Extension is enabled.

There are permissions for both leaving and viewing trader feedback. By default, all registered users have permission
to leave and view feedback, while guests only have permission to view feedback.

When a user leaves trader feedback for someone else, the recipient has the option of replying to that feedback. The
recipient of that new feedback (the original sender) cannot make any further replies.

Users have the option of leaving private comments when leaving trader feedback to someone else. These private comments
can only be viewed by the sender of the feedback, its recipient, and moderators.

Moderators may be given permission to edit and delete trader feedback. Deleted feedback is saved in the database and
may be restored at a later point by moderators. Upon editing the feedback, moderators can view its edit history. The
original sender of the feedback can edit their feedback for a limited period of time after it was initially sent, and
they cannot view the edit history.

Moderation
----------
If a moderator has edit/delete permissions for trader feedback, they also have access to the Trader report tabs in the
Moderator Control Panel. Moderators may close and/or delete trader feedback reports - similar to how they can
close/delete post and PM reports.

If User A has given User B:
---------------------------
- More +1 (Positive) Feedbacks than -1 (Negative) Feedbacks,
@@ -34,7 +51,30 @@ If User A has given User B:
- More -1 (Negative) Feedbacks than +1 (Positive) Feedbacks,
then User A will rate User B positively in the overall calculation of User A's Trader Score

Files:
======

Trader.php
----------
function construct - setting class members to the arguments passed in

function defaultAction - triggered when url is /trader/give-feedback/
- gathers information from the user request and conducts error checking
- if the form is valid, the feedback, ratings, date and time posted among others are added
to the database
- finally renders the content of the page

function editFeedbackAction - triggered when url is /trader/edit-feedback/
- conducts error checking on modifications to the feedback
- deletes the feedback or submits the changes made
- renders the content modified using the template

function viewUserFeedbackAction - performs error checking and if user is valid
- collects information about the feedback and its latest comment from the database
- renders the user feedback using the template

function report_feedback-action - if user confirms, the feedback gets reported

function getUser - retrieves user information from the database using the user_id

function getTopic - retrieves topic information from the database using the topic_id

0 comments on commit fb1f2ca

Please sign in to comment.
You can’t perform that action at this time.