- fix: notifications from postings
- Refactored the autocommit system to fix the notifications bug above.
This commit is contained in:
parent
2c7f49be9a
commit
02622ea55c
6 changed files with 49 additions and 5 deletions
|
|
@ -230,7 +230,9 @@ sub generateRecurringEvents
|
|||
$properties->{endDate} = $dt->clone->add(days => $duration_days)->strftime('%F');
|
||||
|
||||
|
||||
$parent->addChild($properties);
|
||||
my $newEvent = $parent->addChild($properties);
|
||||
$newEvent->requestAutoCommit;
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
@ -1497,9 +1499,11 @@ sub processPropertiesFromFormPost
|
|||
$properties->{endDate} = $event->get("endDate");
|
||||
|
||||
$event->addRevision($self->get);
|
||||
$event->requestAutoCommit;
|
||||
}
|
||||
}
|
||||
}
|
||||
$self->requestAutoCommit;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -795,6 +795,7 @@ sub postProcess {
|
|||
$size += $storage->getFileSize($file);
|
||||
}
|
||||
$self->setSize($size);
|
||||
$self->requestAutoCommit;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -262,6 +262,7 @@ sub processPropertiesFromFormPost {
|
|||
}
|
||||
|
||||
$self->setSize($size);
|
||||
$self->requestAutoCommit;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ sub addRevision {
|
|||
$newVersion->setVersionLock;
|
||||
$properties->{status} = 'pending';
|
||||
$newVersion->update($properties);
|
||||
$workingTag->requestCommit if ($autoCommitId);
|
||||
$newVersion->setAutoCommitTag($workingTag) if (defined $autoCommitId);
|
||||
return $newVersion;
|
||||
}
|
||||
|
||||
|
|
@ -121,13 +121,11 @@ sub commit {
|
|||
$self->indexContent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getAutoCommitWorkflowId ( )
|
||||
|
||||
Override this method in your asset if you want your asset to auto-commit its workflow each time addRevision() is called on it. Your overridden method must return the workflow Id of the workflow to run on autocommit.
|
||||
Override this method in your asset if you want your asset to automatically run its commit workflow. When this method is specified you addRevision() will instanciate the version tag, set this as the workflow for that version tag, and then call setAutoCommitTag(). Then sometime later in your code before the asset is destroyed you need to call requestAutoCommit() to trigger the workflow.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -257,6 +255,42 @@ sub purgeRevision {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 requestAutoCommit ( )
|
||||
|
||||
Requests an autocommit tag be commited. See also getAutoCommitWorkflowId() and setAutoCommitTag().
|
||||
|
||||
=cut
|
||||
|
||||
sub requestAutoCommit {
|
||||
my $self = shift;
|
||||
my $tag = $self->{_autoCommitTag};
|
||||
if (defined $tag) {
|
||||
$tag->requestCommit;
|
||||
delete $self->{_autoCommitTag};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setAutoCommitTag ( tag )
|
||||
|
||||
Stores the current working auto commit tag temporarily in the live asset object. See also requestAutoCommit() and getAutoCommitWorkflowId().
|
||||
|
||||
=head3 tag
|
||||
|
||||
A WebGUI::VersionTag object.
|
||||
|
||||
=cut
|
||||
|
||||
sub setAutoCommitTag {
|
||||
my $self = shift;
|
||||
my $tag = shift;
|
||||
$self->{_autoCommitTag} = $tag;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setVersionLock ( )
|
||||
|
|
|
|||
|
|
@ -297,6 +297,7 @@ sub execute {
|
|||
{
|
||||
my $calendar = WebGUI::Asset->newByDynamicClass($self->session,$feed->{assetId});
|
||||
my $event = $calendar->addChild($properties);
|
||||
$event->requestAutoCommit;
|
||||
$added++;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue