diff --git a/lib/icinga/checkable-comment.cpp b/lib/icinga/checkable-comment.cpp index 29fc65563..71cfac619 100644 --- a/lib/icinga/checkable-comment.cpp +++ b/lib/icinga/checkable-comment.cpp @@ -19,7 +19,7 @@ void Checkable::RemoveAllComments() } } -void Checkable::RemoveAckComments(const String& removedBy) +void Checkable::RemoveAckComments(const String& removedBy, double createdBefore) { for (const Comment::Ptr& comment : GetComments()) { if (comment->GetEntryType() == CommentAcknowledgement) { @@ -28,6 +28,10 @@ void Checkable::RemoveAckComments(const String& removedBy) continue; } + if (comment->GetEntryTime() > createdBefore) { + continue; + } + { ObjectLock oLock (comment); comment->SetRemovedBy(removedBy); diff --git a/lib/icinga/checkable.hpp b/lib/icinga/checkable.hpp index 96df5bd47..3d48b1445 100644 --- a/lib/icinga/checkable.hpp +++ b/lib/icinga/checkable.hpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace icinga { @@ -156,7 +157,7 @@ public: /* Comments */ void RemoveAllComments(); - void RemoveAckComments(const String& removedBy = String()); + void RemoveAckComments(const String& removedBy = String(), double createdBefore = std::numeric_limits::max()); std::set GetComments() const; Comment::Ptr GetLastComment() const;