Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

Commit

Permalink
Beta 16
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Mar 18, 2021
1 parent f4a53f3 commit e98af2e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
}
],
"require": {
"flarum/core": ">=0.1.0-beta.15",
"guzzlehttp/guzzle": "6.* || 7.*"
"flarum/core": "^0.1.0-beta.16",
"guzzlehttp/guzzle": "^7.2"
},
"replace": {
"reflar/stopforumspam": "*"
Expand All @@ -46,7 +46,7 @@
"extra": {
"flarum-extension": {
"title": "FoF Stop Forum Spam",
"category": "moderation",
"category": "feature",
"icon": {
"name": "fas fa-stop",
"backgroundColor": "#e74c3c",
Expand Down
3 changes: 2 additions & 1 deletion extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
(new Extend\Event())
->listen(MarkedUserAsSpammer::class, Listeners\ReportSpammer::class),

(new Extend\Middleware('forum'))->add(RegisterMiddleware::class),
(new Extend\Middleware('forum'))
->add(RegisterMiddleware::class),
];
12 changes: 9 additions & 3 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
"scripts": {
"build": "webpack --mode production",
"dev": "webpack --mode development --watch",
"lint": "prettier --single-quote --trailing-comma es5 --print-width 150 --tab-width 4 --write src/**/* src/**/**/*"
"lint": "prettier --single-quote --trailing-comma es5 --print-width 150 --tab-width 4 --write src"
},
"devDependencies": {
"prettier": "^1.19.1"
"flarum": "0.1.0-beta.16",
"prettier": "^2.2.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* @var SettingsRepositoryInterface
*/
$settings = app('flarum.settings');
$settings = resolve('flarum.settings');
$keys = ['username', 'email', 'ip', 'frequency', 'api_key'];

foreach ($keys as $key) {
Expand Down
5 changes: 3 additions & 2 deletions src/Listeners/ReportSpammer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use FoF\Spamblock\Event\MarkedUserAsSpammer;
use FoF\StopForumSpam\StopForumSpam;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\Message;

class ReportSpammer
{
Expand Down Expand Up @@ -51,11 +52,11 @@ public function handle(MarkedUserAsSpammer $event)
]);
} catch (RequestException $e) {
throw new ValidationException([
'sfs' => strip_tags(RequestException::getResponseBodySummary($e->getResponse())),
'sfs' => strip_tags(Message::bodySummary($e->getResponse())),
]);
} catch (\Throwable $e) {
throw new ValidationException([
'sfs' => app('translator')->trans('fof-stopforumspam.api.error.unknown'),
'sfs' => resolve('translator')->trans('fof-stopforumspam.api.error.unknown'),
]);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Middleware/RegisterMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
]);
} catch (\Throwable $e) {
return (new JsonApiFormatter())->format(
app(Registry::class)->handle($e),
resolve(Registry::class)->handle($e),
$request
);
}
Expand All @@ -88,9 +88,9 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
if ($frequency !== 0 && $frequency >= (int) $this->settings->get('fof-stopforumspam.frequency')) {
return (new JsonApiFormatter())
->format(
app(Registry::class)
resolve(Registry::class)
->handle(new ValidationException([
'username' => app('translator')->trans('fof-stopforumspam.forum.message.spam'),
'username' => resolve('translator')->trans('fof-stopforumspam.forum.message.spam'),
])),
$request
);
Expand Down

0 comments on commit e98af2e

Please sign in to comment.