* Format user detail and date.

This commit is contained in:
dingguodong
2021-08-31 15:24:12 +08:00
parent 3e7f292efc
commit 3fbc826d42
+14 -4
View File
@@ -135,7 +135,7 @@ class productIssueEntry extends entry
$actions = $this->loadModel('action')->getList($type, $id);
$issue->comments = $this->processActions($type, $actions);
$issue->comments = array_values($this->processActions($type, $actions));
/**
* Get all users in issues so that we can bulk get user detail later.
@@ -176,7 +176,7 @@ class productIssueEntry extends entry
$accountsList = array();
foreach($actions as $action)
{
$accountsListp[] = $action->actor;
$accountsList[] = $action->actor;
ob_start();
$this->action->printAction($action);
$action->title = ob_get_contents();
@@ -188,16 +188,26 @@ class productIssueEntry extends entry
{
ob_start();
$this->action->printChanges($action->objectType, $action->history);
$action->body_html = json_encode(ob_get_contents());
$action->body_html = ob_get_contents();
ob_clean();
}
if(!empty($action->comment))
{
$comment = strip_tags($action->comment) == $action->comment ? nl2br($action->comment) : $action->comment;
$action->body_html = json_encode("<div class='comment-content'>{$comment}</div>");
$action->body_html = "<div class='comment-content'>{$comment}</div>";
}
}
/* Format user detail and date. */
$accountsList = array_unique($accountsList);
$userDetails = $this->loadModel('user')->getUserDetailsForAPI($accountsList);
foreach($actions as $action)
{
$action->actor = $userDetails[$action->actor];
$action->date = gmdate("Y-m-d\TH:i:s\Z", strtotime($action->date));
}
return $actions;
}
}