mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
Checkable#RemoveAckComments(): add optional comment entry time filter
This commit is contained in:
parent
0470fe12a7
commit
c160c4b62e
@ -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);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <condition_variable>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
@ -149,7 +150,7 @@ public:
|
||||
|
||||
/* Comments */
|
||||
void RemoveAllComments();
|
||||
void RemoveAckComments(const String& removedBy = String());
|
||||
void RemoveAckComments(const String& removedBy = String(), double createdBefore = std::numeric_limits<double>::max());
|
||||
|
||||
std::set<Comment::Ptr> GetComments() const;
|
||||
Comment::Ptr GetLastComment() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user