Skip to content

Commit

Permalink
fix: hard delete options not working
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Nov 20, 2023
1 parent e321eb3 commit 8b036ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions js/src/forum/components/HandleSpammerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ export default class HandleSpammerModal extends Modal<HandleSpammerModalAttrs> {

const body = {
options: {
hardDeletePosts: this.hardDeletePosts,
hardDeleteDiscussions: this.hardDeleteDiscussions,
hardDeleteUser: this.hardDeleteUser,
deletePosts: this.hardDeletePosts,
deleteDiscussions: this.hardDeleteDiscussions,
deleteUser: this.hardDeleteUser,
moveDiscussionsToQuarantine: this.moveDiscussionsToQuarantine,
reportToSfs: this.reportToSfs,
},
Expand Down
16 changes: 7 additions & 9 deletions src/Command/MarkUserAsSpammerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function __construct(ExtensionManager $extensions, Bus $bus, Events $even
$this->log = $log;
}

public function handle(MarkUserAsSpammer $command): void
public function handle(MarkUserAsSpammer $command): User
{
$user = $command->user;
$actor = $command->actor ?? new Guest();
Expand All @@ -91,12 +91,14 @@ public function handle(MarkUserAsSpammer $command): void

$this->handleDiscussions($user, $actor);

$this->handleUser($user, $actor);
$this->handlePosts($user, $actor);
$this->handleUser($user, $actor);

$this->events->dispatch(
new MarkedUserAsSpammer($user, $actor)
);

return $command->user->refresh();
}

protected function parseOptions(array $options): void
Expand All @@ -115,13 +117,6 @@ protected function shouldMoveToQuarantineSetting(): bool
return ($value === null || $value === '[]') ? false : true;
}

protected function getQuanrantineTags(): object
{
$value = $this->settings->get(self::settings_prefix.'moveDiscussionsToTags');

return json_decode($value);
}

protected function flagsEnabled(): bool
{
return $this->extensions->isEnabled('flarum-flags');
Expand Down Expand Up @@ -154,6 +149,9 @@ protected function handleUser(User $user, User $actor): void
'actor' => $actor->id,
]);
}

$user->refreshDiscussionCount();
$user->refreshCommentCount();
}

/**
Expand Down

0 comments on commit 8b036ee

Please sign in to comment.