Fixing some failing tests

This commit is contained in:
Paul Driver 2010-10-07 16:14:48 -07:00
parent 93ce217ad9
commit c86ee12651
4 changed files with 26 additions and 9 deletions

View file

@ -2627,15 +2627,14 @@ sub setState {
stateChanged = ?
WHERE assetId = ?
};
my @props = ($state, $self->session->user->userId, time);
$self->session->db->write(
$sql, [
$state,
$self->session->user->userId,
time,
@props,
$self->getId,
]
);
$self->{_properties}->{state} = $state;
@{$self->{_properties}}{qw(state stateChangedBy stateChanged)} = @props;
$self->purgeCache;
}

View file

@ -328,7 +328,16 @@ sub trash {
$outputSub->($i18n->get('Clearing cache'));
$asset->purgeCache;
$asset->updateHistory("trashed");
$asset->setState($asset->getId eq $rootId ? 'trash' : 'trash-limbo');
if ($asset->getId eq $rootId) {
$asset->setState('trash');
# setState will take care of _properties in $asset, but not in
# $self (whooops!), so we need to manually update.
my @keys = qw(state stateChangedBy stateChanged);
@{$self->{_properties}}{@keys} = @{$asset->{_properties}}{@keys};
}
else {
$asset->setState('trash-limbo');
}
}
$db->commit;