Commit c0411b84 authored by Mark Harding's avatar Mark Harding
Browse files

(wip): staging work in progress changes

parent fb2a961c
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -19,7 +19,7 @@ class jury implements Interfaces\Api
        $juryType = $pages[0] ?? 'appeal';
        $juryType = $pages[0] ?? 'appeal';


        if ($juryType !== 'appeal' && !Core\Session::isAdmin()) {
        if ($juryType !== 'appeal' && !Core\Session::isAdmin()) {
            //exit;
            exit;
        }
        }


        $juryManager = Di::_()->get('Moderation\Jury\Manager');
        $juryManager = Di::_()->get('Moderation\Jury\Manager');
@@ -39,7 +39,7 @@ class jury implements Interfaces\Api
    public function post($pages)
    public function post($pages)
    {
    {
        $juryType = $pages[0] ?? null;
        $juryType = $pages[0] ?? null;
        $entityGuid = $pages[1] ?? null;
        $urn = $pages[1] ?? null;
        $uphold = $_POST['uphold'] ?? null;
        $uphold = $_POST['uphold'] ?? null;


        if (!$juryType) {
        if (!$juryType) {
@@ -49,10 +49,10 @@ class jury implements Interfaces\Api
            ]);
            ]);
        }
        }
        
        
        if (!$entityGuid) {
        if (!$urn) {
            return Factory::response([
            return Factory::response([
                'status' => 'error',
                'status' => 'error',
                'message' => 'You must supply the entity guid in the URI like /:juryType/:entityGuid',
                'message' => 'You must supply the entity urn in the URI like /:juryType/:urn',
            ]);
            ]);
        }
        }


@@ -63,7 +63,7 @@ class jury implements Interfaces\Api
            ]);
            ]);
        }
        }


        if (!Core\Session::getLoggedInUser()->getPhoneNumberHash() && false) {
        if (!Core\Session::getLoggedInUser()->getPhoneNumberHash()) {
            return Factory::response([
            return Factory::response([
                'status' => 'error',
                'status' => 'error',
                'message' => 'juror must be in the rewards program',
                'message' => 'juror must be in the rewards program',
@@ -72,7 +72,7 @@ class jury implements Interfaces\Api


        $juryManager = Di::_()->get('Moderation\Jury\Manager');
        $juryManager = Di::_()->get('Moderation\Jury\Manager');
        $moderationManager = Di::_()->get('Moderation\Manager');
        $moderationManager = Di::_()->get('Moderation\Manager');
        $report = $moderationManager->getReport($entityGuid);
        $report = $moderationManager->getReport($urn);


        $decision = new Decision();
        $decision = new Decision();
        $decision
        $decision
+4 −0
Original line number Original line Diff line number Diff line
@@ -69,6 +69,10 @@ class report implements Interfaces\Api
            ->setReporterGuid($user->getGuid())
            ->setReporterGuid($user->getGuid())
            ->setTimestamp(round(microtime(true) * 1000));
            ->setTimestamp(round(microtime(true) * 1000));


        if ($user->getPhoneNumberHash()) {
            $userReport->setReporterHash($user->getPhoneNumberHash());
        }

        if (!$manager->add($userReport)) {
        if (!$manager->add($userReport)) {
            return Factory::response([
            return Factory::response([
                'status' => 'error',
                'status' => 'error',
+1 −1
Original line number Original line Diff line number Diff line
@@ -34,7 +34,7 @@ class EntityGuidResolverDelegate implements ResolverDelegate
     */
     */
    public function shouldResolve(Urn $urn)
    public function shouldResolve(Urn $urn)
    {
    {
        return $urn->getNid() === 'entity' || $urn->getNid() === 'activity';
        return $urn->getNid() === 'entity' || $urn->getNid() === 'activity' || $urn->getNid() === 'user';
    }
    }


    /**
    /**
+2 −2
Original line number Original line Diff line number Diff line
@@ -79,12 +79,12 @@ class Repository
                    }
                    }
                    break;
                    break;
                case 'approved':
                case 'approved':
                    if ($report->getState() != 'appeal_jury_decided' && $report->isUpheld() === false) {
                    if ($report->getState() !== 'appeal_jury_decided' || $report->isUpheld() === false) {
                        $skip = true;
                        $skip = true;
                    }
                    }
                    break;
                    break;
                case 'rejected':
                case 'rejected':
                    if ($report->getState() != 'appeal_jury_decided' && $report->isUpheld() === true) {
                    if ($report->getState() !== 'appeal_jury_decided' || $report->isUpheld() === true) {
                        $skip = true;
                        $skip = true;
                    }
                    }
                    break;
                    break;
+2 −2
Original line number Original line Diff line number Diff line
@@ -40,9 +40,9 @@ class Manager
        return $this->repository->getList($opts);
        return $this->repository->getList($opts);
    }
    }


    public function getReport($entity_guid)
    public function getReport($urn)
    {
    {
        return $this->repository->get($entity_guid);
        return $this->repository->get($urn);
    }
    }


    /**
    /**
Loading