/** * Mark a topic as solved or unsolved. * * Route: /topicsolved/mark/{solve}/{post_id} * * @param string $solve Either "solved" or "unsolved". * @param int $post_id Post to mark. * * @return \Symfony\Component\HttpFoundation\Response */ public function mark($solve, $post_id) { $topic_data = $this->topicsolved->get_topic_data($post_id); if (empty($topic_data)) { throw new http_exception(404, 'TOPIC_NOT_FOUND'); } $this->check_solve_conditions($solve, $topic_data); if ($solve == 'solved') { $this->topicsolved->mark_solved($topic_data, $post_id); } else { $this->topicsolved->mark_unsolved($topic_data); } $post_url = $this->topicsolved->get_link_to_post($topic_data['forum_id'], $topic_data['topic_id'], $post_id); return new RedirectResponse($post_url); }