Implement support for downtime comments.

Fixes #3894
This commit is contained in:
Gunnar Beutner 2013-06-19 10:42:28 +02:00
parent 0d64a8fd32
commit e13a6ac23d
2 changed files with 31 additions and 8 deletions

View File

@ -82,9 +82,13 @@ String Service::AddComment(CommentType entryType, const String& author,
}
String id = Utility::NewUniqueID();
comments->Set(id, comment);
Touch("comments");
{
ObjectLock olock(this);
comments->Set(id, comment);
Touch("comments");
}
return id;
}
@ -105,6 +109,8 @@ void Service::RemoveComment(const String& id)
Dictionary::Ptr comments = owner->GetComments();
if (comments) {
ObjectLock olock(owner);
comments->Remove(id);
owner->Touch("comments");
}
@ -208,7 +214,11 @@ void Service::RefreshCommentsCache(void)
legacy_id = l_NextCommentID++;
comment->Set("legacy_id", legacy_id);
service->Touch("comments");
{
ObjectLock olock(service);
service->Touch("comments");
}
}
newLegacyCommentsCache[legacy_id] = id;
@ -254,6 +264,7 @@ void Service::RemoveExpiredComments(void)
comments->Remove(id);
}
ObjectLock olock(this);
Touch("comments");
}
}

View File

@ -79,8 +79,12 @@ String Service::AddDowntime(const String& author, const String& comment,
Dictionary::Ptr otherDowntimes = otherOwner->Get("downtimes");
Dictionary::Ptr otherDowntime = otherDowntimes->Get(triggeredBy);
Dictionary::Ptr triggers = otherDowntime->Get("triggers");
triggers->Set(triggeredBy, triggeredBy);
otherOwner->Touch("downtimes");
{
ObjectLock olock(otherOwner);
triggers->Set(triggeredBy, triggeredBy);
otherOwner->Touch("downtimes");
}
}
Dictionary::Ptr downtimes;
@ -99,7 +103,12 @@ String Service::AddDowntime(const String& author, const String& comment,
String id = Utility::NewUniqueID();
downtimes->Set(id, downtime);
Touch("downtimes");
{
ObjectLock olock(this);
Touch("downtimes");
}
(void) AddComment(CommentDowntime, author, comment, endTime);
return id;
}
@ -116,8 +125,11 @@ void Service::RemoveDowntime(const String& id)
if (!downtimes)
return;
downtimes->Remove(id);
owner->Touch("downtimes");
{
ObjectLock olock(owner);
downtimes->Remove(id);
owner->Touch("downtimes");
}
}
void Service::TriggerDowntimes(void)