Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: #77 #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions notifications/NewReportAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,26 @@ public function getUrl()
*/
private function getReportedRecord()
{
if ($this->_reportedRecord) {
if ($this->_reportedRecord !== null) {
return $this->_reportedRecord;
}

/* @var ReportContent $report */
// Ensure that the source is an instance of ReportContent
if (!$this->source instanceof ReportContent) {
return null;
}

$report = $this->source;

if (!$report instanceof ReportContent) {
// Check if content_id or comment_id is empty
if (empty($report->content_id) && empty($report->comment_id)) {
return null;
}

if (empty($report->comment_id)) {
// Attempt to retrieve the reported record based on content_id or comment_id
if (!empty($report->content_id)) {
$this->_reportedRecord = Content::findOne(['id' => $report->content_id])->getModel();
} else {
} elseif (!empty($report->comment_id)) {
$this->_reportedRecord = Comment::findOne(['id' => $report->comment_id]);
}

Expand Down