Checkable#RemoveCommentsByType(): remove redundant parameter

This commit is contained in:
Alexander A. Klimov 2023-03-03 11:53:02 +01:00
parent cf517050bc
commit dceb29c742
5 changed files with 11 additions and 10 deletions

View File

@ -275,7 +275,7 @@ Dictionary::Ptr ApiActions::RemoveAcknowledgement(const ConfigObject::Ptr& objec
String removedBy (HttpUtility::GetLastParameter(params, "author"));
checkable->ClearAcknowledgement(removedBy);
checkable->RemoveCommentsByType(CommentAcknowledgement, removedBy);
checkable->RemoveAckComments(removedBy);
return ApiActions::CreateResult(200, "Successfully removed acknowledgement for object '" + checkable->GetName() + "'.");
}

View File

@ -321,7 +321,7 @@ Checkable::ProcessingResult Checkable::ProcessCheckResult(const CheckResult::Ptr
olock.Unlock();
if (remove_acknowledgement_comments)
RemoveCommentsByType(CommentAcknowledgement);
RemoveAckComments();
Dictionary::Ptr vars_after = new Dictionary({
{ "state", new_state },

View File

@ -19,14 +19,15 @@ void Checkable::RemoveAllComments()
}
}
void Checkable::RemoveCommentsByType(int type, const String& removedBy)
void Checkable::RemoveAckComments(const String& removedBy)
{
for (const Comment::Ptr& comment : GetComments()) {
/* Do not remove persistent comments from an acknowledgement */
if (comment->GetEntryType() == CommentAcknowledgement && comment->GetPersistent())
continue;
if (comment->GetEntryType() == CommentAcknowledgement) {
/* Do not remove persistent comments from an acknowledgement */
if (comment->GetPersistent()) {
continue;
}
if (comment->GetEntryType() == type) {
{
ObjectLock oLock (comment);
comment->SetRemovedBy(removedBy);

View File

@ -156,7 +156,7 @@ public:
/* Comments */
void RemoveAllComments();
void RemoveCommentsByType(int type, const String& removedBy = String());
void RemoveAckComments(const String& removedBy = String());
std::set<Comment::Ptr> GetComments() const;
Comment::Ptr GetLastComment() const;

View File

@ -665,7 +665,7 @@ void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const std::vecto
service->ClearAcknowledgement("");
}
service->RemoveCommentsByType(CommentAcknowledgement);
service->RemoveAckComments();
}
void ExternalCommandProcessor::AcknowledgeHostProblem(double, const std::vector<String>& arguments)
@ -738,7 +738,7 @@ void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const std::vect
ObjectLock olock(host);
host->ClearAcknowledgement("");
}
host->RemoveCommentsByType(CommentAcknowledgement);
host->RemoveAckComments();
}
void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const std::vector<String>& arguments)