Skip to content

Commit

Permalink
Flarum 1.0 (#19)
Browse files Browse the repository at this point in the history
* Update for v1

* Apply fixes from StyleCI

Co-authored-by: Ian Morland <[email protected]>
  • Loading branch information
imorland and imorland authored Jun 25, 2021
1 parent 592232f commit d379c08
Show file tree
Hide file tree
Showing 32 changed files with 1,493 additions and 871 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Ban IPs by FriendsOfFlarum

![License](https://img.shields.io/badge/license-MIT-blue.svg) [![Latest Stable Version](https://img.shields.io/packagist/v/fof/ban-ips.svg)](https://packagist.org/packages/fof/ban-ips) [![OpenCollective](https://img.shields.io/badge/opencollective-fof-blue.svg)](https://opencollective.com/fof/donate) [![Donate](https://img.shields.io/badge/donate-datitisev-important.svg)](https://datitisev.me/donate)
![License](https://img.shields.io/badge/license-MIT-blue.svg) [![Latest Stable Version](https://img.shields.io/packagist/v/fof/ban-ips.svg)](https://packagist.org/packages/fof/ban-ips) [![Compatibility](https://flarum-badge-api.davwheat.dev/v1/compat-latest/fof/ban-ips)](https://flarum-badge-api.davwheat.dev/v1/compat-latest/fof/ban-ips) [![OpenCollective](https://img.shields.io/badge/opencollective-fof-blue.svg)](https://opencollective.com/fof/donate) [![Donate](https://img.shields.io/badge/donate-datitisev-important.svg)](https://datitisev.me/donate)

A [Flarum](http://flarum.org) extension. Ban IP addresses from your forum.

### Installation

Use [Bazaar](https://discuss.flarum.org/d/5151-flagrow-bazaar-the-extension-marketplace) or install manually with Composer:
Install with Composer:

```sh
composer require fof/ban-ips
composer require fof/ban-ips:"*"
```

### Updating

```sh
composer update fof/ban-ips
composer update fof/ban-ips:"*"
```

### Links
Expand Down
17 changes: 14 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@
}
],
"require": {
"flarum/core": "^0.1.0-beta.15"
"flarum/core": "^1.0.3"
},
"authors": [
{
"name": "David Sevilla Martín",
"email": "[email protected]",
"role": "Developer"
},
{
"name": "IanM",
"homepage": "https://discuss.flarum.org/u/ianm",
"role": "Developer"
}
],
"autoload": {
Expand All @@ -36,12 +41,18 @@
"extra": {
"flarum-extension": {
"title": "FoF Ban IPs",
"category": "moderation",
"category": "feature",
"icon": {
"name": "fas fa-gavel",
"backgroundColor": "#e74c3c",
"color": "#fff"
}
},
"optional-dependencies": [
"flarum/suspend",
"flarum/flags",
"flarum/tags",
"flarum/approval"
]
},
"flagrow": {
"discuss": "https://discuss.flarum.org/d/20949"
Expand Down
10 changes: 8 additions & 2 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@
->modelPolicy(User::class, Access\UserPolicy::class),

(new Extend\ApiSerializer(Serializer\PostSerializer::class))
->mutate(function (AbstractSerializer $serializer, AbstractModel $post, array $attributes): array {
->attributes(function (AbstractSerializer $serializer, AbstractModel $post, array $attributes): array {
$attributes['canBanIP'] = $serializer->getActor()->can('banIP', $post);

return $attributes;
})
->hasOne('banned_ip', BannedIPSerializer::class),

(new Extend\ApiSerializer(Serializer\UserSerializer::class))
->mutate(BanUserAttributes::class)
->attributes(BanUserAttributes::class)
->hasMany('banned_ips', BannedIPSerializer::class),

(new Extend\ApiController(Controller\ShowUserController::class))
Expand Down Expand Up @@ -103,4 +103,10 @@

(new Extend\ApiController(Controller\UpdatePostController::class))
->addInclude(['banned_ip', 'banned_ip.user']),

(new Extend\SimpleFlarumSearch(Search\BannedIPSearcher::class))
->setFullTextGambit(Search\NxGambit::class),

(new Extend\Filter(Search\BannedIPFilterer::class))
->addFilter(Search\NxGambit::class),
];
Loading

0 comments on commit d379c08

Please sign in to comment.