mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 21:55:03 +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()) {
|
for (const Comment::Ptr& comment : GetComments()) {
|
||||||
if (comment->GetEntryType() == CommentAcknowledgement) {
|
if (comment->GetEntryType() == CommentAcknowledgement) {
|
||||||
@ -28,6 +28,10 @@ void Checkable::RemoveAckComments(const String& removedBy)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (comment->GetEntryTime() > createdBefore) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock oLock (comment);
|
ObjectLock oLock (comment);
|
||||||
comment->SetRemovedBy(removedBy);
|
comment->SetRemovedBy(removedBy);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
@ -149,7 +150,7 @@ public:
|
|||||||
|
|
||||||
/* Comments */
|
/* Comments */
|
||||||
void RemoveAllComments();
|
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;
|
std::set<Comment::Ptr> GetComments() const;
|
||||||
Comment::Ptr GetLastComment() const;
|
Comment::Ptr GetLastComment() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user