Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
Hasan Özbey committed Jun 27, 2021
1 parent 53b9b86 commit cb3285c
Show file tree
Hide file tree
Showing 32 changed files with 5,927 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### 0.1.0
First release.
File renamed without changes.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
flarum-miserable-users

# Miserable Users

[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/the-turk/flarum-miserable-users/blob/master/LICENSE) [![Latest Stable Version](https://img.shields.io/packagist/v/the-turk/flarum-miserable-users.svg)](https://packagist.org/packages/the-turk/flarum-miserable-users) [![Total Downloads](https://img.shields.io/packagist/dt/the-turk/flarum-miserable-users.svg)](https://packagist.org/packages/the-turk/flarum-miserable-users)

Make the browsing experience of problematic users as frustrating as possible.

Running a community forum like the discuss? Kylo got your back, brothers. Show them no mercy. Do some nasty redirections, if you know what I mean 😏

![](https://i.imgur.com/3SR6lQ8.png)

- [Sample miserable user](https://i.imgur.com/GylCEKY.png)
- [Control modal](https://i.imgur.com/bHIVVWJ.png)
- [Sample broken page](https://i.imgur.com/wpcqW0K.png)

**Note:** "Miserable User" badge will (hopefully) only show up to users those can class others as miserables, no worries. 😂

## Installation

```bash
composer require the-turk/flarum-miserable-users
```

## Links

- [Source code on GitHub](https://github.com/the-turk/flarum-miserable-users)
- [Changelog](https://github.com/the-turk/blob/master/CHANGELOG.md)
- [Report an issue](https://github.com/the-turk/flarum-miserable-users/issues)
- [Download via Packagist](https://packagist.org/packages/the-turk/flarum-miserable-users)
46 changes: 46 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "the-turk/flarum-miserable-users",
"description": "Make the browsing experience of problematic users as frustrating as possible.",
"keywords": [
"flarum",
"miserable",
"user",
"management",
"ban"
],
"type": "flarum-extension",
"license": "MIT",
"authors": [
{
"name": "Hasan Özbey",
"email": "[email protected]",
"homepage": "https://github.com/the-turk"
}
],
"support": {
"issues": "https://github.com/the-turk/flarum-miserable-users/issues",
"source": "https://github.com/the-turk/flarum-miserable-users"
},
"require": {
"flarum/core": "^1.0.0"
},
"autoload": {
"psr-4": {
"TheTurk\\Miserable\\": "src/"
}
},
"replace":{
"the-turk/flarum-miserable-users": "*"
},
"extra": {
"flarum-extension": {
"title": "Miserable Users",
"category": "feature",
"icon": {
"name": "far fa-sad-cry",
"backgroundColor": "#b72a2a",
"color": "#fff"
}
}
}
}
70 changes: 70 additions & 0 deletions extend.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

/*
* This file is part of the-turk/flarum-miserable-users.
*
* Copyright (c) 2020 Hasan Özbey
*
* LICENSE: For the full copyright and license information,
* please view the LICENSE file that was distributed
* with this source code.
*/

namespace TheTurk\Miserable;

use Flarum\Extend;

use TheTurk\Miserable\Access\UserPolicy;
use TheTurk\Miserable\AddUserMiserableAttributes;
use TheTurk\Miserable\AddCurrentUserMiserableAttributes;
use TheTurk\Miserable\Listener;
use TheTurk\Miserable\Query\MiserableFilterGambit;
use Flarum\Api\Serializer\UserSerializer;
use Flarum\Api\Serializer\CurrentUserSerializer;
use Flarum\User\Event\Saving;
use Flarum\User\Filter\UserFilterer;
use Flarum\User\Search\UserSearcher;
use Flarum\User\User;
use Flarum\Post\Event\Saving as PostSaving;

return [
(new Extend\Frontend('forum'))
->css(__DIR__.'/less/forum.less')
->js(__DIR__.'/js/dist/forum.js'),

(new Extend\Frontend('admin'))
->css(__DIR__.'/less/admin.less')
->js(__DIR__.'/js/dist/admin.js'),

(new Extend\Locales(__DIR__.'/locale')),

(new Extend\Model(User::class))
->dateAttribute('miserable_until'),

(new Extend\ApiSerializer(UserSerializer::class))
->attributes(AddUserMiserableAttributes::class),

(new Extend\ApiSerializer(CurrentUserSerializer::class))
->attributes(AddCurrentUserMiserableAttributes::class),

(new Extend\Event())
->listen(Saving::class, Listener\SaveMiserableToDatabase::class)
->listen(PostSaving::class, Listener\SetFakeFloodings::class),

(new Extend\Policy())
->modelPolicy(User::class, UserPolicy::class),

(new Extend\Filter(UserFilterer::class))
->addFilter(MiserableFilterGambit::class),

(new Extend\Settings())
->serializeToForum('miserable_users.loading_delay_min', 'the-turk-miserable-users.loading_delay_min')
->serializeToForum('miserable_users.loading_delay_max', 'the-turk-miserable-users.loading_delay_max')
->serializeToForum('miserable_users.broken_page_chance', 'the-turk-miserable-users.broken_page_chance')
->serializeToForum('miserable_users.redirection_page_url', 'the-turk-miserable-users.redirection_page_url')
->serializeToForum('miserable_users.redirection_chance', 'the-turk-miserable-users.redirection_chance')
->serializeToForum('miserable_users.log_out_chance', 'the-turk-miserable-users.log_out_chance'),

(new Extend\SimpleFlarumSearch(UserSearcher::class))
->addGambit(MiserableFilterGambit::class)
];
6 changes: 6 additions & 0 deletions js/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 150,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
}
1 change: 1 addition & 0 deletions js/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src/admin';
2 changes: 2 additions & 0 deletions js/dist/admin.js

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

1 change: 1 addition & 0 deletions js/dist/admin.js.map

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

Loading

0 comments on commit cb3285c

Please sign in to comment.