Dispatch Comment voted event.

@param CommentInterface $comment Comment
@param VoteInterface    $vote    Vote
@param bool             $edited  Vote is edition of one already added

@return $this Self object
550595
public function dispatchCommentOnVotedEvent(
        CommentInterface $comment,
        VoteInterface $vote,
        $edited
    ) {
        $event = new CommentOnVotedEvent(
            $comment,
            $vote,
            $edited
        );

        $this
            ->eventDispatcher
            ->dispatch(ElcodiCommentEvents::COMMENT_ONVOTED, $event);

        return $this;
    }
160226
public function onAfterPostComment(Comment $comment)
    {
        $parent = $comment->Parent();

        if (!$parent || !$parent->hasMethod('notificationRecipients')) {
            return;
        }

        // Ask parent to submit all recipients
        $recipients = $parent->notificationRecipients($comment);

        foreach ($recipients as $recipient) {
            $this->notifyCommentRecipient($comment, $parent, $recipient);
        }
    }
1279462
public function addComment($comment)
    {
        $comment->setPaymentId($this->getPaymentId());
        $comment->save();

        $this->load($this->getPaymentId());

        return $comment;
    }
1255204
public function removeComment(Comment $comment)
    {
        if ($this->comments->contains($comment)) {
            $this->comments->removeElement($comment);
            $comment->setTask(null);
        }

        return $this;
    }
71124
public function voteup($voter)
    {
        //first check if we have voted down if yes then just remove that
        if ($votedown = $this->votedowns->getQuery(true)
                                        ->disableChain()
                                        ->voter($voter)
                                        ->fetch()
        ) {
            $votedown->delete();
        } else {
            //find ore create a voteup
            $voteup = $this->voteups->addNew(array('voter' => $voter, 'votee' => $this));
            //if the votee is suscribable then subscribe the voter
            if ($this->isSubscribable() && !$this->subscribed($voter)) {
                $this->addSubscriber($voter);
            }
            $this->_mixer->execute('after.voteup', new AnCommandContext(array('vote' => $voteup)));
        }
    }
1188776
public function addComment($comment)
    {
        if(Yii::$app->params['commentNeedApproval'])
            $comment->status = Comment::STATUS_PENDING;
        else
            $comment->status = Comment::STATUS_APPROVED;
        // set model and parent_id (parent model ID)
        $comment->model = self::COMMENT_FOR;
        $comment->parent_id = $this->id;
        $comment->user_id = \Yii::$app->user->id;
        if($comment->thread == '-')
            // set new thread
            $comment->thread = time() . uniqid();
        else
            // unmark previous comment
            Yii::$app->db->createCommand("UPDATE {{%comment}} SET last=0 WHERE thread='{$comment->thread}' AND last=1")->execute();
        // mark only last comment in a thread
        $comment->last = 1;
        if($comment->save()) {
            if(Yii::$app->params['notifyResponsibleAboutComment'])
                $comment->trigger(Comment::EVENT_JUST_ADDED);
            $comment->content = '';
            return true;
        } else
            return false;
    }
873786
public function checkIn($comment)
    {
        $qry = new InvokePostMethodQuery($this->getResourcePath(), "checkIn", array(
            "comment" => $comment,
            "checkintype" => 0
        ));
        $this->getContext()->addQuery($qry);
    }
870810
public function setComment(\Haven\CmsBundle\Entity\Comment $comment = null)
    {
        $this->comment = $comment;

        return $this;
    }
481732
public function save(Comment $comment, Request $request)
    {
        $comment
            ->fill($request->get('comment'))
            ->save();

        Alert::info(__('Comment was saved'));

        return redirect()->route('platform.systems.comments');
    }
11549
public function hasAccessToComment($commentID)
    {

        $this->isLoggedIn();

        $userid = $this->di->get("session")->get("userid");
        $comment = new Comment();
        $comment->setDb($this->di->get("db"));
        $user = new User();
        $user->setDb($this->di->get("db"));

        $user->find("id", $userid);
        $comment->find("id", $commentID);

        if (($comment->user_id == $userid) || $this->isAdmin()) {
            return true;
        }
        $this->di->get("response")->redirect("user");
        return false;
    }
271811
function editComment($commentId, array $comment)
    {
        $params = array(1, $this->username, $this->password, $commentId, $comment);

        return $this->sendRequest('wp.editComment', $params);
    }
762489
public function setComment($comment)
    {
        $thisCVID = $this->getVersionID();
        $comment = ($comment != null) ? $comment : "Version {$thisCVID}";
        $v = array(
            $comment,
            $thisCVID,
            $this->cID,
        );
        $app = Facade::getFacadeApplication();
        $db = $app->make('database')->connection();
        $q = "update CollectionVersions set cvComments = ? where cvID = ? and cID = ?";
        $db->executeQuery($q, $v);
        $this->cvComments = $comment;
    }
659259
public function vote(
        CommentInterface $comment,
        $authorToken,
        $type
    ) {
        /**
         * @var VoteInterface $vote
         */
        $vote = $this
            ->commentVoteObjectDirector
            ->findOneBy([
                'authorToken' => $authorToken,
                'comment' => $comment,
            ]);

        $edited = true;

        if (!($vote instanceof VoteInterface)) {
            $vote = $this
                ->commentVoteObjectDirector
                ->create()
                ->setAuthorToken($authorToken)
                ->setComment($comment);

            $edited = false;
        }

        $vote->setType($type);

        $this
            ->commentVoteObjectDirector
            ->save($vote);

        $this
            ->commentEventDispatcher
            ->dispatchCommentOnVotedEvent($comment, $vote, $edited);

        return $vote;
    }
185824
public function delete($commentid) {
        global $DB, $USER;
        $candelete = has_capability('moodle/comment:delete', $this->context);
        if (!$comment = $DB->get_record('comments', array('id'=>$commentid))) {
            throw new comment_exception('dbupdatefailed');
        }
        if (!($USER->id == $comment->userid || !empty($candelete))) {
            throw new comment_exception('nopermissiontocomment');
        }
        $DB->delete_records('comments', array('id'=>$commentid));
        // Trigger comment delete event.
        if (core_component::is_core_subsystem($this->component)) {
            $eventclassname = '\\core\\event\\' . $this->component . '_comment_deleted';
        } else {
            $eventclassname = '\\' . $this->component . '\\event\comment_deleted';
        }
        if (class_exists($eventclassname)) {
            $event = $eventclassname::create(
                    array(
                        'context' => $this->context,
                        'objectid' => $commentid,
                        'other' => array(
                            'itemid' => $this->itemid
                            )
                        ));
            $event->add_record_snapshot('comments', $comment);
            $event->trigger();
        }
        return true;
    }
550264
def comment_vote(self, comment_id, score):
        
        params = {'score': score}
        return self._get('comments/{0}/votes.json'.format(comment_id), params,
                         method='POST', auth=True)
1313401
protected function commentChangeStatus(ProxyQueryInterface $query, $status)
    {
        if (false === $this->admin->isGranted('EDIT')) {
            throw new AccessDeniedException();
        }

        foreach ($query->execute() as $comment) {
            $comment->setStatus($status);

            $this->admin->getModelManager()->update($comment);
        }

        return new RedirectResponse($this->admin->generateUrl('list', $this->admin->getFilterParameters()));
    }
247425
public function edit($commentId, $body)
	{
		// Build the request path.
		$path = '/gists/comments/' . (int) $commentId;

		// Build the request data.
		$data = json_encode(
			array(
				'body' => $body
			)
		);

		// Send the request.
		$response = $this->client->patch($this->fetchUrl($path), $data);

		// Validate the response code.
		if ($response->code != 200)
		{
			// Decode the error response and throw an exception.
			$error = json_decode($response->body);
			throw new \DomainException($error->message, $response->code);
		}

		return json_decode($response->body);
	}