Skip to content

Commit 850ff94

Browse files
committed
Merge remote-tracking branch 'lorekeeper/release/v3.0.0' into extension/carousel
2 parents d23b653 + 713f962 commit 850ff94

103 files changed

Lines changed: 5763 additions & 5331 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/Lint.yml

Lines changed: 77 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,89 @@ on:
99
- '**'
1010
types:
1111
- opened
12-
- edited
1312
- synchronize
1413
- reopened
1514

1615
jobs:
1716
pint:
18-
uses: itinerare/github-actions/.github/workflows/pint.yml@main
19-
with:
20-
php-version: '8.1'
17+
runs-on: ubuntu-latest
18+
19+
permissions:
20+
contents: write
21+
2122
concurrency:
22-
group: ci-${{ github.head_ref || github.ref_name }}
23+
group: ci-pint-${{ github.head_ref || github.ref_name }}
24+
cancel-in-progress: true
25+
26+
steps:
27+
- uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2
28+
with:
29+
php-version: 8.1
30+
31+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
32+
with:
33+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
34+
ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
35+
36+
- name: Get composer cache directory
37+
id: composer-cache
38+
run: |
39+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
40+
41+
- name: Cache or restore composer cache
42+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4
43+
with:
44+
path: ${{ steps.composer-cache.outputs.dir }}
45+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
46+
restore-keys: |
47+
${{ runner.os }}-composer-
48+
49+
- name: Install dependencies
50+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --ignore-platform-reqs
51+
52+
- name: Run pint
53+
run: composer lint
54+
55+
- name: Commit changes
56+
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
57+
with:
58+
pull: '--rebase --autostash'
59+
message: 'refactor: fix PHP styling'
60+
committer_name: github-actions[bot]
61+
committer_email: github-actions[bot]@users.noreply.github.com
2362

2463
blade-formatter:
25-
uses: itinerare/github-actions/.github/workflows/blade_formatter.yml@main
64+
runs-on: ubuntu-latest
65+
66+
permissions:
67+
contents: write
68+
2669
concurrency:
27-
group: ci-${{ github.head_ref || github.ref_name }}
70+
group: ci-blade-formatter-${{ github.head_ref || github.ref_name }}
71+
cancel-in-progress: true
72+
73+
steps:
74+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
75+
with:
76+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
77+
ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
78+
79+
- name: Set up node
80+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
81+
with:
82+
node-version: 22.x
83+
cache: 'npm'
84+
85+
- name: Install packages
86+
run: npm install
87+
88+
- name: Run blade-formatter
89+
run: npm run format
90+
91+
- name: Commit changes
92+
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
93+
with:
94+
pull: '--rebase --autostash'
95+
message: 'refactor: fix blade formatting'
96+
committer_name: github-actions[bot]
97+
committer_email: github-actions[bot]@users.noreply.github.com

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ For support and general questions and discussions, please visit the [support Dis
44

55
The following are accepted uses for the [issue tracker](https://github.com/corowne/Lorekeeper/issues):
66
- Bug reports
7-
- Feature or enhancement requests (within reason)-- note that these may be denied if they are deemed out of scope of the project and/or are not feasible to implement for any reason.
7+
- Feature or enhancement requests *or* discussion of potential new features (within reason)-- note that these may be denied if they are deemed out of scope of the project and/or are not feasible to implement for any reason.
88

99
## Opening an Issue
1010
### Reporting a bug
@@ -24,7 +24,7 @@ Avoid listing multiple requests in one issue. One issue per request makes it eas
2424

2525
## Contributing Code
2626

27-
Please see the full [Contribution Guide](http://wiki.lorekeeper.me/index.php?title=Contributing_to_Lorekeeper) for more information!
27+
Please see the full [Contribution Guide](https://lk-arpg.github.io/lk-docs/prerelease/contributing/) for more information!
2828

2929
### About abandoned pull requests
3030

app/Actions/Fortify/CreateNewUser.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Actions\Fortify;
44

55
use App\Models\Invitation;
6+
use App\Models\Rank\Rank;
67
use App\Models\User\User;
78
use App\Services\InvitationService;
89
use App\Services\UserService;
@@ -20,11 +21,14 @@ class CreateNewUser implements CreatesNewUsers {
2021
public function create(array $input) {
2122
(new UserService)->validator($input)->validate();
2223

24+
// Create a user with the lowest existing rank
25+
$rank_id = Rank::orderBy('sort')->first()->id;
26+
2327
$user = User::create([
2428
'name' => $input['name'],
2529
'email' => $input['email'],
2630
'password' => Hash::make($input['password']),
27-
'rank_id' => 2,
31+
'rank_id' => $rank_id,
2832
'birthday' => $input['dob'],
2933
]);
3034
$user->settings()->create([
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Models\Character\CharacterDesignUpdate;
6+
use App\Models\Character\CharacterImage;
7+
use Illuminate\Console\Command;
8+
use Intervention\Image\Facades\Image;
9+
10+
class FixCharacterImageFormats extends Command {
11+
/**
12+
* The name and signature of the console command.
13+
*
14+
* @var string
15+
*/
16+
protected $signature = 'app:fix-character-image-formats';
17+
18+
/**
19+
* The console command description.
20+
*
21+
* @var string
22+
*/
23+
protected $description = 'Converts existing fullsize character and design update images not stored as the configured file format.';
24+
25+
/**
26+
* Execute the console command.
27+
*/
28+
public function handle() {
29+
$masterlistFormat = config('lorekeeper.settings.masterlist_image_format');
30+
$fullsizeFormat = config('lorekeeper.settings.masterlist_fullsizes_format');
31+
32+
$images = CharacterImage::where('fullsize_extension', '!=', $fullsizeFormat);
33+
if ($images->count()) {
34+
$this->info('Processing '.$images->count().' images...');
35+
$images->update(['fullsize_extension' => $fullsizeFormat]);
36+
37+
foreach ($images->get() as $image) {
38+
if (file_exists($image->imagePath.'/'.$image->id.'_'.$image->hash.'_'.$image->fullsize_hash.'_full.'.$masterlistFormat)) {
39+
Image::make($image->imagePath.'/'.$image->id.'_'.$image->hash.'_'.$image->fullsize_hash.'_full.'.$masterlistFormat)->save($image->imagePath.'/'.$image->fullsizeFileName, 100, $fullsizeFormat);
40+
41+
if (file_exists($image->imagePath.'/'.$image->fullsizeFileName)) {
42+
unlink($image->imagePath.'/'.$image->id.'_'.$image->hash.'_'.$image->fullsize_hash.'_full.'.$masterlistFormat);
43+
}
44+
}
45+
}
46+
}
47+
48+
$updates = CharacterDesignUpdate::where('status', '!=', 'Approved');
49+
if ($updates->count()) {
50+
$this->info('Processing '.$updates->count().' updates...');
51+
foreach ($updates->get() as $update) {
52+
$updates->update(['extension' => $fullsizeFormat]);
53+
54+
if (file_exists($update->imagePath.'/'.$update->id.'_'.$update->hash.'.'.$masterlistFormat)) {
55+
Image::make($update->imagePath.'/'.$update->id.'_'.$update->hash.'.'.$masterlistFormat)->save($update->imagePath.'/'.$update->imageFileName, 100, $fullsizeFormat);
56+
57+
if (file_exists($update->imagePath.'/'.$update->imageFileName)) {
58+
unlink($update->imagePath.'/'.$update->id.'_'.$update->hash.'.'.$masterlistFormat);
59+
}
60+
}
61+
62+
if (!file_exists($update->imagePath.'/'.$update->thumbnailFileName) && file_exists($update->imagePath.'/'.$update->id.'_'.$update->hash.'_th.'.$fullsizeFormat)) {
63+
Image::make($update->imagePath.'/'.$update->id.'_'.$update->hash.'_th.'.$fullsizeFormat)->save($update->imagePath.'/'.$update->thumbnailFileName, 100, $masterlistFormat);
64+
65+
if (file_exists($update->imagePath.'/'.$update->thumbnailFileName)) {
66+
unlink($update->imagePath.'/'.$update->id.'_'.$update->hash.'_th.'.$fullsizeFormat);
67+
}
68+
}
69+
}
70+
}
71+
}
72+
}

app/Console/Commands/SetupAdminUser.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ public function handle() {
4646
if (!Rank::count()) {
4747
// These need to be created even if the seeder isn't run for the site to work correctly.
4848
$adminRank = Rank::create([
49-
'name' => 'Admin',
50-
'description' => 'The site admin. Has the ability to view/edit any data on the site.',
51-
'sort' => 1,
49+
'name' => 'Admin',
50+
'description' => 'The site admin. Has the ability to view/edit any data on the site.',
51+
'parsed_description' => 'The site admin. Has the ability to view/edit any data on the site.',
52+
'sort' => 1,
5253
]);
5354
Rank::create([
54-
'name' => 'Member',
55-
'description' => 'A regular member of the site.',
56-
'sort' => 0,
55+
'name' => 'Member',
56+
'description' => 'A regular member of the site.',
57+
'parsed_description' => 'A regular member of the site.',
58+
'sort' => 0,
5759
]);
5860

5961
$this->line('User ranks not found. Default user ranks (admin and basic member) created.');

app/Http/Controllers/Auth/LoginController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getAuthCallback(LinkService $service, $provider) {
6363
$socialite->redirectUrl(str_replace('auth', 'login', url(config('services.'.$provider.'.redirect'))));
6464
$result = $socialite->user();
6565

66-
$user = UserAlias::where('user_snowflake', $result->id)->first();
66+
$user = UserAlias::where('site', $provider)->where('user_snowflake', $result->id)->first();
6767
if (!$user) {
6868
return redirect('/register/'.$provider)->with(['userData' => $result]);
6969
}

app/Http/Controllers/BrowseController.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class BrowseController extends Controller {
3232
* @return \Illuminate\Contracts\Support\Renderable
3333
*/
3434
public function getUsers(Request $request) {
35-
$query = User::visible()->join('ranks', 'users.rank_id', '=', 'ranks.id')->select('ranks.name AS rank_name', 'users.*');
35+
$query = User::visible()->with('primaryAlias')->join('ranks', 'users.rank_id', '=', 'ranks.id')->select('ranks.name AS rank_name', 'users.*');
3636
$sort = $request->only(['sort']);
3737

3838
if ($request->get('name')) {
@@ -106,7 +106,7 @@ public function getDeactivated(Request $request) {
106106
'canView' => $canView,
107107
'privacy' => $privacy,
108108
'key' => $key,
109-
'users' => $canView ? User::where('is_deactivated', 1)->orderBy('users.name')->paginate(30)->appends($request->query()) : null,
109+
'users' => $canView ? User::where('is_deactivated', 1)->with('primaryAlias', 'settings')->orderBy('users.name')->paginate(30)->appends($request->query()) : null,
110110
]);
111111
}
112112

@@ -137,7 +137,7 @@ public function getBlacklist(Request $request) {
137137
'canView' => $canView,
138138
'privacy' => $privacy,
139139
'key' => $key,
140-
'users' => $canView ? User::where('is_banned', 1)->orderBy('users.name')->paginate(30)->appends($request->query()) : null,
140+
'users' => $canView ? User::where('is_banned', 1)->with('primaryAlias', 'settings')->orderBy('users.name')->paginate(30)->appends($request->query()) : null,
141141
]);
142142
}
143143

@@ -147,8 +147,8 @@ public function getBlacklist(Request $request) {
147147
* @return \Illuminate\Contracts\Support\Renderable
148148
*/
149149
public function getCharacters(Request $request) {
150-
$query = Character::with('user.rank')->with('image.features')->with('rarity')->with('image.species')->myo(0);
151-
$imageQuery = CharacterImage::images(Auth::check() ? Auth::user() : null)->with('features')->with('rarity')->with('species')->with('features');
150+
$query = Character::with('user.rank', 'image.features', 'rarity', 'image.species', 'image.rarity')->myo(0);
151+
$imageQuery = CharacterImage::images(Auth::check() ? Auth::user() : null)->with('features', 'rarity', 'species', 'features');
152152

153153
if ($sublists = Sublist::where('show_main', 0)->get()) {
154154
$subCategories = [];
@@ -328,9 +328,9 @@ public function getCharacters(Request $request) {
328328
* @return \Illuminate\Contracts\Support\Renderable
329329
*/
330330
public function getMyos(Request $request) {
331-
$query = Character::with('user.rank')->with('image.features')->with('rarity')->with('image.species')->myo(1);
331+
$query = Character::with('user.rank', 'image.features', 'rarity', 'image.species', 'image.rarity')->myo(1);
332332

333-
$imageQuery = CharacterImage::images(Auth::check() ? Auth::user() : null)->with('features')->with('rarity')->with('species')->with('features');
333+
$imageQuery = CharacterImage::images(Auth::check() ? Auth::user() : null)->with('features', 'rarity', 'species', 'features');
334334

335335
if ($request->get('name')) {
336336
$query->where(function ($query) use ($request) {
@@ -442,7 +442,7 @@ public function getMyos(Request $request) {
442442

443443
return view('browse.myo_masterlist', [
444444
'isMyo' => true,
445-
'slots' => $query->paginate(30)->appends($request->query()),
445+
'slots' => $query->paginate(24)->appends($request->query()),
446446
'specieses' => [0 => 'Any Species'] + Species::visible(Auth::check() ? Auth::user() : null)->orderBy('specieses.sort', 'DESC')->pluck('name', 'id')->toArray(),
447447
'rarities' => [0 => 'Any Rarity'] + Rarity::orderBy('rarities.sort', 'DESC')->pluck('name', 'id')->toArray(),
448448
'features' => Feature::getDropdownItems(),
@@ -459,8 +459,8 @@ public function getMyos(Request $request) {
459459
* @return \Illuminate\Contracts\Support\Renderable
460460
*/
461461
public function getSublist(Request $request, $key) {
462-
$query = Character::with('user.rank')->with('image.features')->with('rarity')->with('image.species')->myo(0);
463-
$imageQuery = CharacterImage::with('features')->with('rarity')->with('species')->with('features');
462+
$query = Character::with('user.rank', 'image.features', 'rarity', 'image.species', 'image.rarity')->myo(0);
463+
$imageQuery = CharacterImage::with('features', 'rarity', 'species', 'features');
464464

465465
$sublist = Sublist::where('key', $key)->first();
466466
if (!$sublist) {

app/Http/Controllers/Characters/CharacterController.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function getCharacterGallery(Request $request, $slug) {
202202
return view('character.gallery', [
203203
'character' => $this->character,
204204
'extPrevAndNextBtnsUrl' => '/gallery',
205-
'submissions' => GallerySubmission::whereIn('id', $this->character->gallerySubmissions->pluck('gallery_submission_id')->toArray())->visible()->accepted()->orderBy('created_at', 'DESC')->paginate(20)->appends($request->query()),
205+
'submissions' => GallerySubmission::whereIn('id', $this->character->gallerySubmissions->pluck('gallery_submission_id')->toArray())->visible(Auth::user() ?? null)->orderBy('created_at', 'DESC')->paginate(20),
206206
]);
207207
}
208208

@@ -234,13 +234,15 @@ public function getCharacterInventory($slug) {
234234

235235
$items = count($categories) ?
236236
$this->character->items()
237+
->with('category')
237238
->where('count', '>', 0)
238239
->orderByRaw('FIELD(item_category_id,'.implode(',', $categories->pluck('id')->toArray()).')')
239240
->orderBy('name')
240241
->orderBy('updated_at')
241242
->get()
242243
->groupBy(['item_category_id', 'id']) :
243244
$this->character->items()
245+
->with('category')
244246
->where('count', '>', 0)
245247
->orderBy('name')
246248
->orderBy('updated_at')
@@ -254,11 +256,8 @@ public function getCharacterInventory($slug) {
254256
'items' => $items,
255257
'logs' => $this->character->getItemLogs(),
256258
] + (Auth::check() && (Auth::user()->hasPower('edit_inventories') || Auth::user()->id == $this->character->user_id) ? [
257-
'itemOptions' => $itemOptions->pluck('name', 'id'),
258-
'userInventory' => UserItem::with('item')->whereIn('item_id', $itemOptions->pluck('id'))->whereNull('deleted_at')->where('count', '>', '0')->where('user_id', Auth::user()->id)->get()->filter(function ($userItem) {
259-
return $userItem->isTransferrable == true;
260-
})->sortBy('item.name'),
261-
'page' => 'character',
259+
'itemOptions' => $itemOptions->pluck('name', 'id'),
260+
'page' => 'character',
262261
] : []));
263262
}
264263

0 commit comments

Comments
 (0)