-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 20aadd9
Showing
38 changed files
with
4,959 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
[*.md] | ||
indent_size = 2 | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
js/src export-ignore | ||
.git* export-ignore | ||
|
||
js/dist/*.js -diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
vendor | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Clark Winkelmann | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Shadow Ban | ||
|
||
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/clarkwinkelmann/flarum-ext-shadow-ban/blob/master/LICENSE.md) [![Latest Stable Version](https://img.shields.io/packagist/v/clarkwinkelmann/flarum-ext-shadow-ban.svg)](https://packagist.org/packages/clarkwinkelmann/flarum-ext-shadow-ban) [![Total Downloads](https://img.shields.io/packagist/dt/clarkwinkelmann/flarum-ext-shadow-ban.svg)](https://packagist.org/packages/clarkwinkelmann/flarum-ext-shadow-ban) [![Donate](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/clarkwinkelmann) | ||
|
||
This extension implements shadow ban and content deletion for Flarum. | ||
|
||
When a discussion or post is shadow hidden, only the author and users with permission "Shadow hide discussions and posts" will see it. | ||
|
||
A user can be shadow banned for a given duration via their profile. | ||
When a user is shadow banned, all their new discussions and posts are automatically shadow hidden. | ||
They are **not restored** when the shadow ban ends. | ||
|
||
Optionally you can enable the users to be shadow hidden when shadow banned. | ||
When a user is shadow hidden, their profile will no longer be accessible by direct link and they won't be offered in search and mention auto-completion. | ||
|
||
## Installation | ||
|
||
composer require clarkwinkelmann/flarum-ext-shadow-ban | ||
|
||
## Support | ||
|
||
This extension is under **active maintenance**. | ||
|
||
Bugfixes and compatibility updates will be published for free as time allows. | ||
|
||
You can [contact me](https://clarkwinkelmann.com/flarum) to sponsor additional features. | ||
|
||
Support is offered on a "best effort" basis through the Flarum community thread. | ||
|
||
## Links | ||
|
||
- [GitHub](https://github.com/clarkwinkelmann/flarum-ext-shadow-ban) | ||
- [Packagist](https://packagist.org/packages/clarkwinkelmann/flarum-ext-shadow-ban) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "clarkwinkelmann/flarum-ext-shadow-ban", | ||
"description": "Shadow ban Flarum users", | ||
"keywords": [ | ||
"flarum", | ||
"shadow", | ||
"ban" | ||
], | ||
"type": "flarum-extension", | ||
"license": "MIT", | ||
"require": { | ||
"flarum/core": "^1.0" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Clark Winkelmann", | ||
"email": "[email protected]", | ||
"homepage": "https://clarkwinkelmann.com/", | ||
"role": "Developer" | ||
} | ||
], | ||
"support": { | ||
"issues": "https://github.com/clarkwinkelmann/flarum-ext-shadow-ban/issues", | ||
"source": "https://github.com/clarkwinkelmann/flarum-ext-shadow-ban" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"ClarkWinkelmann\\ShadowBan\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"flarum-extension": { | ||
"title": "Shadow ban", | ||
"category": "feature", | ||
"icon": { | ||
"name": "fas fa-volume-mute", | ||
"backgroundColor": "#684ba6", | ||
"color": "#fff" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace ClarkWinkelmann\ShadowBan; | ||
|
||
use Flarum\Api\Serializer\DiscussionSerializer; | ||
use Flarum\Api\Serializer\PostSerializer; | ||
use Flarum\Api\Serializer\UserSerializer; | ||
use Flarum\Discussion\Discussion; | ||
use Flarum\Discussion\Event\Saving as DiscussionSaving; | ||
use Flarum\Extend; | ||
use Flarum\Post\Event\Saving as PostSaving; | ||
use Flarum\Post\Post; | ||
use Flarum\User\Event\Saving as UserSaving; | ||
use Flarum\User\User; | ||
|
||
return [ | ||
(new Extend\Frontend('admin')) | ||
->js(__DIR__ . '/js/dist/admin.js'), | ||
|
||
(new Extend\Frontend('forum')) | ||
->js(__DIR__ . '/js/dist/forum.js') | ||
->css(__DIR__ . '/resources/less/forum.less'), | ||
|
||
new Extend\Locales(__DIR__ . '/resources/locale'), | ||
|
||
(new Extend\Model(User::class)) | ||
->dateAttribute('shadow_banned_until'), | ||
|
||
(new Extend\Event()) | ||
->listen(DiscussionSaving::class, Listener\SaveDiscussion::class) | ||
->listen(PostSaving::class, Listener\SavePost::class) | ||
->listen(UserSaving::class, Listener\SaveUser::class), | ||
|
||
(new Extend\Policy()) | ||
->modelPolicy(Discussion::class, Policy\DiscussionPolicy::class) | ||
->modelPolicy(Post::class, Policy\PostPolicy::class) | ||
->modelPolicy(User::class, Policy\UserPolicy::class), | ||
|
||
(new Extend\ModelVisibility(Discussion::class)) | ||
->scope(Scope\ViewDiscussion::class), | ||
(new Extend\ModelVisibility(Post::class)) | ||
->scope(Scope\ViewPost::class), | ||
(new Extend\ModelVisibility(User::class)) | ||
->scope(Scope\ViewUser::class), | ||
|
||
(new Extend\ApiSerializer(DiscussionSerializer::class)) | ||
->attributes(DiscussionAttributes::class), | ||
(new Extend\ApiSerializer(PostSerializer::class)) | ||
->attributes(PostAttributes::class), | ||
(new Extend\ApiSerializer(UserSerializer::class)) | ||
->attributes(UserAttributes::class), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './src/admin'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.