public function get_discussion_renderer(
        forum_entity $forum,
        discussion_entity $discussion,
        int $displaymode
    ) : discussion_renderer {

        $capabilitymanager = $this->managerfactory->get_capability_manager($forum);
        $ratingmanager = $this->managerfactory->get_rating_manager();
        $rendererbase = $this->rendererbase;

        $baseurl = $this->urlfactory->get_discussion_view_url_from_discussion($discussion);
        $notifications = [];

        return new discussion_renderer(
            $forum,
            $discussion,
            $displaymode,
            $rendererbase,
            $this->get_single_discussion_posts_renderer($displaymode, false),
            $this->page,
            $this->legacydatamapperfactory,
            $this->exporterfactory,
            $this->vaultfactory,
            $capabilitymanager,
            $ratingmanager,
            $this->entityfactory->get_exported_posts_sorter(),
            $baseurl,
            $notifications,
            function($discussion, $user, $forum) {
                $exportbuilder = $this->builderfactory->get_exported_discussion_builder();
                return $exportedposts = $exportbuilder->build(
                    $user,
                    $forum,
                    $discussion
                );
            }
        );
    }