Skip to content

Commit

Permalink
Item2321: use Func::move* for DELETE, like I always should have
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/RestPlugin@10195 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Dec 6, 2010
1 parent 09db74f commit fc98f77
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions lib/Foswiki/UI/Query.pm
Expand Up @@ -472,28 +472,24 @@ print STDERR "\n\nPOST: create new topic Meta ("

}
elsif ( $request_method eq 'DELETE' ) {
#TODO: uniqueness...
if ($elementAlias eq 'webs') {
ASSERT(Foswiki::Func::webExists($web)) if DEBUG;
} elsif ($elementAlias eq 'topic') {
ASSERT(Foswiki::Func::topicExists($web, $topic)) if DEBUG;

} elsif ($elementAlias eq 'attachments') {
ASSERT(Foswiki::Func::attachmentExists($web, $topic, $attachment)) if DEBUG;
}else {
die 'you cant remove that';
}
$topicObject->removeFromStore( $attachment );

if ($elementAlias eq 'webs') {
Foswiki::Func::moveWeb($web, $Foswiki::cfg{TrashWebName}.'.'.$web);
ASSERT(not Foswiki::Func::webExists($web)) if DEBUG;
} elsif ($elementAlias eq 'topic') {
ASSERT(Foswiki::Func::topicExists($web, $topic)) if DEBUG;
Foswiki::Func::moveTopic($web, $topic, $Foswiki::cfg{TrashWebName}, $topic);
ASSERT(not Foswiki::Func::topicExists($web, $topic)) if DEBUG;

} elsif ($elementAlias eq 'attachments') {
ASSERT(Foswiki::Func::attachmentExists($web, $topic, $attachment)) if DEBUG;
Foswiki::Func::moveAttachment($web, $topic, $attachment, $Foswiki::cfg{TrashWebName}, 'TrashAttament');
ASSERT(not Foswiki::Func::attachmentExists($web, $topic, $attachment)) if DEBUG;
}else {
die 'you cant remove that';
}

$result = {};
}
else {
Expand Down

0 comments on commit fc98f77

Please sign in to comment.