Skip to content

Commit

Permalink
Merge branch 'release/v3.0.0' of https://github.com/corowne/lorekeeper
Browse files Browse the repository at this point in the history
…into extension/criteria-3.0.0
  • Loading branch information
ScuffedNewt committed Jun 30, 2024
2 parents 7158092 + 8da3a23 commit 498b15d
Show file tree
Hide file tree
Showing 31 changed files with 234 additions and 130 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/Lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Lint

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
Expand All @@ -16,9 +19,9 @@ jobs:
with:
php-version: '8.1'
concurrency:
group: ci-${{ github.head_ref }}
group: ci-${{ github.head_ref || github.ref_name }}

blade-formatter:
uses: itinerare/github-actions/.github/workflows/blade_formatter.yml@main
concurrency:
group: ci-${{ github.head_ref }}
group: ci-${{ github.head_ref || github.ref_name }}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Users/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function getUserInventory($name) {
}

/**
* Shows a user's profile.
* Shows a user's Bank.
*
* @param string $name
*
Expand Down
31 changes: 12 additions & 19 deletions app/Http/Controllers/WorldController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getCurrencies(Request $request) {
}

return view('world.currencies', [
'currencies' => $query->orderBy('name')->paginate(20)->appends($request->query()),
'currencies' => $query->orderBy('name')->orderBy('id')->paginate(20)->appends($request->query()),
]);
}

Expand All @@ -67,7 +67,7 @@ public function getRarities(Request $request) {
}

return view('world.rarities', [
'rarities' => $query->orderBy('sort', 'DESC')->paginate(20)->appends($request->query()),
'rarities' => $query->orderBy('sort', 'DESC')->orderBy('id')->paginate(20)->appends($request->query()),
]);
}

Expand All @@ -86,7 +86,7 @@ public function getSpecieses(Request $request) {
return view('world.specieses', [
'specieses' => $query->with(['subtypes' => function ($query) {
$query->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC');
}])->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->paginate(20)->appends($request->query()),
}])->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->orderBy('id')->paginate(20)->appends($request->query()),
]);
}

Expand All @@ -103,7 +103,7 @@ public function getSubtypes(Request $request) {
}

return view('world.subtypes', [
'subtypes' => $query->with('species')->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->paginate(20)->appends($request->query()),
'subtypes' => $query->with('species')->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->orderBy('id')->paginate(20)->appends($request->query()),
]);
}

Expand All @@ -120,7 +120,7 @@ public function getItemCategories(Request $request) {
}

return view('world.item_categories', [
'categories' => $query->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->paginate(20)->appends($request->query()),
'categories' => $query->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->orderBy('id')->paginate(20)->appends($request->query()),
]);
}

Expand All @@ -137,7 +137,7 @@ public function getFeatureCategories(Request $request) {
}

return view('world.feature_categories', [
'categories' => $query->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->paginate(20)->appends($request->query()),
'categories' => $query->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->orderBy('id')->paginate(20)->appends($request->query()),
]);
}

Expand Down Expand Up @@ -212,7 +212,7 @@ public function getFeatures(Request $request) {
}

return view('world.features', [
'features' => $query->paginate(20)->appends($request->query()),
'features' => $query->orderBy('id')->paginate(20)->appends($request->query()),
'rarities' => ['none' => 'Any Rarity'] + Rarity::orderBy('sort', 'DESC')->pluck('name', 'id')->toArray(),
'specieses' => ['none' => 'Any Species'] + ['withoutOption' => 'Without Species'] + Species::visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->pluck('name', 'id')->toArray(),
'subtypes' => ['none' => 'Any Subtype'] + ['withoutOption' => 'Without Subtype'] + Subtype::visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->pluck('name', 'id')->toArray(),
Expand Down Expand Up @@ -306,11 +306,7 @@ public function getSpeciesFeatureDetail($speciesId, $id) {
* @return \Illuminate\Contracts\Support\Renderable
*/
public function getItems(Request $request) {
$query = Item::with('category');

if (!Auth::check() || !Auth::user()->isStaff) {
$query->released();
}
$query = Item::with('category')->released(Auth::user() ?? null);

$categoryVisibleCheck = ItemCategory::visible(Auth::check() ? Auth::user() : null)->pluck('id', 'name')->toArray();
// query where category is visible, or, no category and released
Expand Down Expand Up @@ -355,7 +351,7 @@ public function getItems(Request $request) {
}

return view('world.items', [
'items' => $query->paginate(20)->appends($request->query()),
'items' => $query->orderBy('id')->paginate(20)->appends($request->query()),
'categories' => ['none' => 'Any Category'] + ['withoutOption' => 'Without Category'] + ItemCategory::visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->pluck('name', 'id')->toArray(),
'shops' => Shop::orderBy('sort', 'DESC')->get(),
'artists' => ['none' => 'Any Artist'] + User::whereIn('id', Item::whereNotNull('artist_id')->pluck('artist_id')->toArray())->pluck('name', 'id')->toArray(),
Expand All @@ -372,11 +368,8 @@ public function getItems(Request $request) {
public function getItem($id) {
$categories = ItemCategory::orderBy('sort', 'DESC')->get();

if (!Auth::check() || !Auth::user()->isStaff) {
$item = Item::where('id', $id)->released()->first();
} else {
$item = Item::where('id', $id)->first();
}
$item = Item::where('id', $id)->released(Auth::user() ?? null)->first();

if (!$item) {
abort(404);
}
Expand Down Expand Up @@ -409,7 +402,7 @@ public function getCharacterCategories(Request $request) {
}

return view('world.character_categories', [
'categories' => $query->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->paginate(20)->appends($request->query()),
'categories' => $query->visible(Auth::check() ? Auth::user() : null)->orderBy('sort', 'DESC')->orderBy('id')->paginate(20)->appends($request->query()),
]);
}
}
7 changes: 6 additions & 1 deletion app/Models/Character/Character.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,15 @@ public function scopeMyo($query, $isMyo = false) {
* Scope a query to only include visible characters.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param mixed|null $user
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeVisible($query) {
public function scopeVisible($query, $user = null) {
if ($user && $user->hasPower('manage_characters')) {
return $query;
}

return $query->where('is_visible', 1);
}

Expand Down
7 changes: 6 additions & 1 deletion app/Models/Item/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,15 @@ public function scopeSortOldest($query) {
* Scope a query to show only released or "released" (at least one user-owned stack has ever existed) items.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param mixed|null $user
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeReleased($query) {
public function scopeReleased($query, $user = null) {
if ($user && $user->hasPower('edit_data')) {
return $query;
}

return $query->where('is_released', 1);
}

Expand Down
14 changes: 12 additions & 2 deletions config/lorekeeper/admin_sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,27 @@
],
],
],
'Site' => [
'power' => 'edit_pages',
'News' => [
'power' => 'manage_news',
'links' => [
[
'name' => 'News',
'url' => 'admin/news',
],
],
],
'Sales' => [
'power' => 'manage_sales',
'links' => [
[
'name' => 'Sales',
'url' => 'admin/sales',
],
],
],
'Pages' => [
'power' => 'edit_pages',
'links' => [
[
'name' => 'Pages',
'url' => 'admin/pages',
Expand Down
2 changes: 1 addition & 1 deletion config/lorekeeper/notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
508 => [
'name' => 'Gallery Submission Rejected',
'message' => 'Your submission <strong>{submission_title}</strong> (#{submission_id}) was rejected. (<a href="{url}">View Submission</a>)',
'url' => 'submissions/queue/{submission_id}',
'url' => 'gallery/queue/{submission_id}',
],

// GALLERY_SUBMISSION_VALUED
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AdjustDatabaseCharacterLimits extends Migration {
/**
* Run the migrations.
*/
public function up() {
Schema::table('character_log', function (Blueprint $table) {
$table->text('log')->change();
$table->text('data')->nullable()->change();
});

Schema::table('character_items', function (Blueprint $table) {
$table->text('data')->nullable()->change();
});

Schema::table('currencies_log', function (Blueprint $table) {
$table->text('log')->nullable()->change();
});

Schema::table('items_log', function (Blueprint $table) {
$table->text('log')->nullable()->change();
$table->text('data')->nullable()->change();
});

Schema::table('user_character_log', function (Blueprint $table) {
$table->text('log')->change();
$table->text('data')->nullable()->change();
});

Schema::table('user_items', function (Blueprint $table) {
$table->text('data')->nullable()->change();
});

Schema::table('user_update_log', function (Blueprint $table) {
$table->text('data')->change();
});
}

/**
* Reverse the migrations.
*/
public function down() {
Schema::table('character_log', function (Blueprint $table) {
$table->string('log', 191)->change();
$table->string('data', 1024)->nullable()->change();
});

Schema::table('character_items', function (Blueprint $table) {
$table->string('data', 1024)->nullable()->change();
});

Schema::table('currencies_log', function (Blueprint $table) {
$table->string('log', 512)->nullable()->change();
});

Schema::table('items_log', function (Blueprint $table) {
$table->string('log', 1024)->nullable()->change();
$table->string('data', 1024)->nullable()->change();
});

Schema::table('user_character_log', function (Blueprint $table) {
$table->string('log', 191)->change();
$table->string('data', 1024)->nullable()->change();
});

Schema::table('user_items', function (Blueprint $table) {
$table->string('data', 1024)->nullable()->change();
});

Schema::table('user_update_log', function (Blueprint $table) {
$table->string('data', 512)->change();
});
}
}
76 changes: 39 additions & 37 deletions resources/views/admin/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,49 +155,51 @@
</p>
</div>
@endif
@if ($galleryRequireApproval)
<div class="col-sm-6">
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">Gallery Submissions @if ($gallerySubmissionCount)
<span class="badge badge-primary">{{ $gallerySubmissionCount }}</span>
@endif
</h5>
<p class="card-text">
@if ($gallerySubmissionCount)
{{ $gallerySubmissionCount }} gallery submission{{ $gallerySubmissionCount == 1 ? '' : 's' }} awaiting processing.
@else
The gallery submission queue is clear. Hooray!
@endif
</p>
<div class="text-right">
<a href="{{ url('admin/gallery/submissions/pending') }}" class="card-link">View Queue <span class="fas fa-caret-right ml-1"></span></a>
@if (Auth::user()->hasPower('manage_submissions'))
@if ($galleryRequireApproval)
<div class="col-sm-6">
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">Gallery Submissions @if ($gallerySubmissionCount)
<span class="badge badge-primary">{{ $gallerySubmissionCount }}</span>
@endif
</h5>
<p class="card-text">
@if ($gallerySubmissionCount)
{{ $gallerySubmissionCount }} gallery submission{{ $gallerySubmissionCount == 1 ? '' : 's' }} awaiting processing.
@else
The gallery submission queue is clear. Hooray!
@endif
</p>
<div class="text-right">
<a href="{{ url('admin/gallery/submissions/pending') }}" class="card-link">View Queue <span class="fas fa-caret-right ml-1"></span></a>
</div>
</div>
</div>
</div>
</div>
@endif
@if ($galleryCurrencyAwards)
<div class="col-sm-6">
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">Gallery Currency Awards @if ($galleryAwardCount)
<span class="badge badge-primary">{{ $galleryAwardCount }}</span>
@endif
</h5>
<p class="card-text">
@if ($galleryAwardCount)
{{ $galleryAwardCount }} gallery submission{{ $galleryAwardCount == 1 ? '' : 's' }} awaiting currency rewards.
@else
The gallery currency award queue is clear. Hooray!
@endif
</p>
<div class="text-right">
<a href="{{ url('admin/gallery/currency/pending') }}" class="card-link">View Queue <span class="fas fa-caret-right ml-1"></span></a>
@endif
@if ($galleryCurrencyAwards)
<div class="col-sm-6">
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">Gallery Currency Awards @if ($galleryAwardCount)
<span class="badge badge-primary">{{ $galleryAwardCount }}</span>
@endif
</h5>
<p class="card-text">
@if ($galleryAwardCount)
{{ $galleryAwardCount }} gallery submission{{ $galleryAwardCount == 1 ? '' : 's' }} awaiting currency rewards.
@else
The gallery currency award queue is clear. Hooray!
@endif
</p>
<div class="text-right">
<a href="{{ url('admin/gallery/currency/pending') }}" class="card-link">View Queue <span class="fas fa-caret-right ml-1"></span></a>
</div>
</div>
</div>
</div>
</div>
@endif
@endif
</div>
@endsection
Loading

0 comments on commit 498b15d

Please sign in to comment.