-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Add) New torrent moderator group (#4351)
* add: new torrent moderator group - this group is limited to moderating and editing torrents via is_editor and is_torrent_modo group permissions
- Loading branch information
Showing
22 changed files
with
843 additions
and
593 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 |
---|---|---|
@@ -1,27 +1,40 @@ | ||
name: PHP Lint (Pint) | ||
on: [push, pull_request] | ||
jobs: | ||
phplint: | ||
strategy: | ||
matrix: | ||
operating-system: | ||
- ubuntu-22.04 | ||
name: ${{ matrix.operating-system }} | ||
runs-on: ${{ matrix.operating-system }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Run Pint | ||
uses: aglipanci/laravel-pint-action@2.0.0 | ||
with: | ||
preset: psr12 | ||
verboseMode: true | ||
- name: Commit Changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: PHP Style Change (Laravel Pint CI) | ||
commit_user_name: HDVinne | ||
commit_user_email: hdinnovations@protonmail.com | ||
commit_author: HDVinnie <hdinnovations@protonmail.com> | ||
build-assets: | ||
strategy: | ||
matrix: | ||
operating-system: | ||
- ubuntu-22.04 | ||
php-version: | ||
- '8.3' | ||
name: ${{ matrix.operating-system }} | ||
runs-on: ${{ matrix.operating-system }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup PHP 8.3 | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
extensions: curl, dom, gd, libxml, mbstring, zip, mysql, xml, intl, bcmath, redis-phpredis/phpredis@6.0.1 | ||
ini-values: error_reporting=E_ALL | ||
coverage: pcov | ||
tools: composer:v2 | ||
env: | ||
REDIS_CONFIGURE_OPTS: --enable-redis | ||
- name: Install Composer Dependencies | ||
env: | ||
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} | ||
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --optimize-autoloader | ||
- name: Run Pint | ||
run: ./vendor/bin/pint | ||
- name: Commit Changes | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: PHP Style Change (Laravel Pint CI) | ||
commit_user_name: HDVinne | ||
commit_user_email: hdinnovations@protonmail.com | ||
commit_author: HDVinnie <hdinnovations@protonmail.com> |
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
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
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
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
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
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
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
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
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
60 changes: 60 additions & 0 deletions
60
database/migrations/2024_11_26_170256_add_is_torrent_modo_to_groups_table.php
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,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class () extends Migration { | ||
public function up(): void | ||
{ | ||
Schema::table('groups', function (Blueprint $table): void { | ||
$table->boolean('is_torrent_modo')->default(false)->after('is_editor'); | ||
$table->index(['is_torrent_modo']); | ||
}); | ||
|
||
DB::table('groups')->upsert([ | ||
[ | ||
'name' => 'Torrent Moderator', | ||
'slug' => 'torrent-moderator', | ||
'position' => 17, | ||
'color' => '#15B097', | ||
'icon' => config('other.font-awesome').' fa-badge-check', | ||
'effect' => 'none', | ||
'autogroup' => false, | ||
'is_owner' => false, | ||
'is_admin' => false, | ||
'is_modo' => false, | ||
'is_torrent_modo' => true, | ||
'is_editor' => true, | ||
'is_internal' => false, | ||
'is_trusted' => true, | ||
'is_freeleech' => true, | ||
'is_immune' => true, | ||
'can_upload' => true, | ||
'level' => 0, | ||
] | ||
], 'slug'); | ||
|
||
$group = DB::table('groups')->where('slug', '=', 'torrent-moderator')->first(); | ||
|
||
$forumIds = DB::table('forums')->pluck('id'); | ||
|
||
foreach ($forumIds as $forumId) { | ||
DB::table('forum_permissions')->insert([ | ||
'forum_id' => $forumId, | ||
'group_id' => $group->id, | ||
'read_topic' => false, | ||
'reply_topic' => false, | ||
'start_topic' => false, | ||
]); | ||
} | ||
|
||
$staffGroups = DB::table('groups')->where('is_modo', '=', true)->get(); | ||
|
||
foreach ($staffGroups as $staffGroup) { | ||
DB::table('groups')->where('id', $staffGroup->id)->update(['is_torrent_modo' => true]); | ||
} | ||
} | ||
}; |
Oops, something went wrong.