mirror of https://github.com/Icinga/icinga2.git
Merge pull request #8035 from Icinga/feature/expiry-date-comments-4663
/v1/actions/add-comment: add param expiry
This commit is contained in:
commit
f2a532de32
|
@ -274,9 +274,15 @@ Dictionary::Ptr ApiActions::AddComment(const ConfigObject::Ptr& object,
|
|||
if (!params->Contains("author") || !params->Contains("comment"))
|
||||
return ApiActions::CreateResult(400, "Comments require author and comment.");
|
||||
|
||||
double timestamp = 0.0;
|
||||
|
||||
if (params->Contains("expiry")) {
|
||||
timestamp = HttpUtility::GetLastParameter(params, "expiry");
|
||||
}
|
||||
|
||||
String commentName = Comment::AddComment(checkable, CommentUser,
|
||||
HttpUtility::GetLastParameter(params, "author"),
|
||||
HttpUtility::GetLastParameter(params, "comment"), false, 0);
|
||||
HttpUtility::GetLastParameter(params, "comment"), false, timestamp);
|
||||
|
||||
Comment::Ptr comment = Comment::GetByName(commentName);
|
||||
|
||||
|
|
Loading…
Reference in New Issue