/v1/actions/add-comment: add param expiry

refs #4663
This commit is contained in:
Alexander A. Klimov 2020-05-27 11:41:22 +02:00
parent 9f45c29239
commit 5b7f7344df

View File

@ -269,9 +269,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);