From 5b7f7344df1dea54f9e3da078e65b03b7655024c Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 27 May 2020 11:41:22 +0200 Subject: [PATCH] /v1/actions/add-comment: add param expiry refs #4663 --- lib/icinga/apiactions.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/icinga/apiactions.cpp b/lib/icinga/apiactions.cpp index 8a7e8a9a8..5c1377818 100644 --- a/lib/icinga/apiactions.cpp +++ b/lib/icinga/apiactions.cpp @@ -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);