Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v11.6 - Bugfixes and major backend improvement preparations #2600

Merged
merged 26 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8eb86f1
#2545 Better aligning vertical elements when descriptions and multi-l…
Wotuu Oct 23, 2024
43c6a1e
#2545 Edit sidebar now properly align everything the way I want it to
Wotuu Oct 24, 2024
4e840e7
#2545 View sidebar now also properly align everything the way I want …
Wotuu Oct 24, 2024
68d073e
#2594 Translations are now available in the database, so you can join…
Wotuu Oct 24, 2024
80e995c
#2594 Seeder now also correctly inserts the name of the root in the k…
Wotuu Oct 24, 2024
1aeba4d
#2584 WIP fixing show across teams map icon setting
Wotuu Oct 24, 2024
513a536
#2584 "Show icon for all routes of same dungeon in team" now works ag…
Wotuu Oct 25, 2024
86b857b
#2591 Route title is now properly replaced when you edit it.
Wotuu Oct 25, 2024
d648ea9
#2590 Map header is now a bit less busy when a route is popular (such…
Wotuu Oct 25, 2024
3c48336
#2582 Pull descriptions can now have a length of greater than 255. Ha…
Wotuu Oct 25, 2024
e0e2629
#2585 WIP fixing/upgrading live route synchronization
Wotuu Oct 25, 2024
06ed05e
#2585 I now know why the route synchronization does not work - REDIS …
Wotuu Oct 25, 2024
5ed93e8
#2595 WIP changes done to a route are kept in a separate table, to di…
Wotuu Oct 28, 2024
521abe3
#2484 Editing an icon twice or adding a killzone to a pull while in f…
Wotuu Oct 29, 2024
56b8316
#2484 Editing a path, brushline or enemy patrol twice in a row now pr…
Wotuu Oct 29, 2024
ab2e8e4
#2595 Adding, changing, deleting map icons is now tracked in the Dung…
Wotuu Oct 29, 2024
62a5320
#2595 Adding, changing, deleting killzones now logs this all in the D…
Wotuu Oct 29, 2024
334bb64
#2595 Adding, changing, deleting brushlines now logs this all in the …
Wotuu Oct 30, 2024
b209cbb
#2595 Adding, changing, deleting paths and enemy patrols now logs thi…
Wotuu Oct 30, 2024
23f1a64
#2595 Unit tests pass again
Wotuu Oct 30, 2024
c3b7292
#2597 Fixed multiple crashes.
Wotuu Oct 30, 2024
9038c96
#2596 Should now be sending both facade and non-facade coordinates to…
Wotuu Oct 31, 2024
133e3e3
#2585 MapIcons are now synced using new system instead of old
Wotuu Nov 3, 2024
102b16b
#2596 Editing a map icon now properly takes into account facade and n…
Wotuu Nov 3, 2024
afe8930
#2599 Added release v11.6
Wotuu Nov 4, 2024
b4cad18
#2599 Fixed affixes seeder
Wotuu Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions app/Console/Commands/Database/SeedOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace App\Console\Commands\Database;

use App\Console\Commands\Traits\ExecutesShellCommands;
use App\Repositories\Database\ReleaseRepository;
use App\Repositories\Interfaces\ReleaseRepositoryInterface;
use App\Service\Cache\CacheServiceInterface;
use Database\Seeders\DatabaseSeeder;
use Illuminate\Console\Command;
Expand Down Expand Up @@ -55,13 +52,15 @@ public function handle(
): int {
$className = $this->argument('className');

$databaseSeeder->setCommand($this);

$this->resolver->setDefaultConnection($this->getDatabase());

try {
$classNames = explode(',', $className);
$this->info(sprintf('Seeding database with only %s...', implode(', ', $classNames)));

$fullClassNames = collect()->map(function ($className) {
$fullClassNames = collect($classNames)->map(function ($className) {
return 'Database\\Seeders\\' . $className;
})->toArray();

Expand Down
4 changes: 3 additions & 1 deletion app/Console/Commands/Scheduler/SchedulerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public function trackTime(callable $callable): int
{
Stopwatch::start(__METHOD__);

// Prevent long tasks from inserting the point very late
$startTime = time();
try {
$callable();
} catch (\Exception $ex) {
Expand All @@ -26,7 +28,7 @@ public function trackTime(callable $callable): int
'scheduler',
$this->getTags(),
[$this->getName() => Stopwatch::stop(__METHOD__)],
time()
$startTime
);

return 0;
Expand Down
13 changes: 13 additions & 0 deletions app/Events/ContextEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ public function broadcastOn(): array
} else if ($this->context instanceof Dungeon) {
$result[] = new PresenceChannel(sprintf('%s-mapping-version-edit.%s', config('app.type'), $this->context->getRouteKey()));
}
// if ($this->context instanceof DungeonRoute) {
// $presenceChannel = new PresenceChannel('');
// $presenceChannel->name = sprintf('%s-route-edit.%s', config('app.type'), $this->context->getRouteKey());
// $result[] = new PresenceChannel($presenceChannel);
// } else if ($this->context instanceof LiveSession) {
// $presenceChannel = new PresenceChannel('');
// $presenceChannel->name = sprintf('%s-live-session.%s', config('app.type'), $this->context->getRouteKey());
// $result[] = new PresenceChannel($presenceChannel);
// } else if ($this->context instanceof Dungeon) {
// $presenceChannel = new PresenceChannel('');
// $presenceChannel->name = sprintf('%s-mapping-version-edit.%s', config('app.type'), $this->context->getRouteKey());
// $result[] = new PresenceChannel($presenceChannel);
// }

return $result;
}
Expand Down
4 changes: 3 additions & 1 deletion app/Events/Model/ContextModelEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
namespace App\Events\Model;

use App\Events\ContextEvent;
use App\Models\Interfaces\EventModelInterface;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;

abstract class ContextModelEvent extends ContextEvent
{
public function __construct(Model $context, User $user, protected Model $model)
public function __construct(Model $context, User $user, protected EventModelInterface $model)
{
parent::__construct($context, $user);
}
Expand All @@ -18,6 +19,7 @@ public function broadcastWith(): array
return array_merge(parent::broadcastWith(), [
'model' => $this->model,
'model_class' => $this->model::class,
'model_data' => $this->model->getEventData(),
]);
}
}
22 changes: 9 additions & 13 deletions app/Http/Controllers/Ajax/AjaxBrushlineController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Events\Model\ModelChangedEvent;
use App\Events\Model\ModelDeletedEvent;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Traits\ChangesDungeonRoute;
use App\Http\Controllers\Traits\SavesPolylines;
use App\Http\Controllers\Traits\ValidatesFloorId;
use App\Http\Requests\Brushline\APIBrushlineFormRequest;
Expand Down Expand Up @@ -52,6 +53,8 @@ public function store(
}

DB::transaction(function () use ($coordinatesService, $brushline, $dungeonRoute, $validated, &$result) {
$beforeModel = $brushline === null ? null : clone $brushline;

if ($brushline === null) {
$brushline = Brushline::create([
'dungeon_route_id' => $dungeonRoute->id,
Expand All @@ -69,25 +72,16 @@ public function store(
try {
if ($success) {
// Create a new polyline and save it
$changedFloor = null;
$polyline = $this->savePolyline(
$this->savePolylineToModel(
$coordinatesService,
$dungeonRoute,
$dungeonRoute->mappingVersion,
Polyline::findOrNew($brushline->polyline_id),
$beforeModel,
$brushline,
$validated['polyline'],
$changedFloor
$validated['polyline']
);

// Couple the path to the polyline
$brushline->update([
'polyline_id' => $polyline->id,
'floor_id' => $changedFloor?->id ?? $brushline->floor_id,
]);

// Load the polyline, so it can be echoed back to the user
$brushline->load(['polyline']);

// Something's updated; broadcast it
if (Auth::check()) {
broadcast(new ModelChangedEvent($dungeonRoute, Auth::user(), $brushline));
Expand Down Expand Up @@ -126,6 +120,8 @@ public function delete(Request $request, DungeonRoute $dungeonRoute, Brushline $
broadcast(new ModelDeletedEvent($dungeonRoute, Auth::getUser(), $brushline));
}

$this->dungeonRouteChanged($dungeonRoute, $brushline, null);

// Touch the route so that the thumbnail gets updated
$dungeonRoute->touch();

Expand Down
27 changes: 22 additions & 5 deletions app/Http/Controllers/Ajax/AjaxDungeonRouteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Http\Controllers\Ajax;

use App\Http\Controllers\Controller;
use App\Http\Controllers\Traits\ChangesDungeonRoute;
use App\Http\Controllers\Traits\ListsBrushlines;
use App\Http\Controllers\Traits\ListsDungeonFloorSwitchMarkers;
use App\Http\Controllers\Traits\ListsEnemies;
Expand Down Expand Up @@ -68,6 +69,7 @@ class AjaxDungeonRouteController extends Controller
use ListsEnemyPatrols;
use ListsMapIcons;
use ListsPaths;
use ChangesDungeonRoute;

/**
* @return mixed
Expand Down Expand Up @@ -238,11 +240,9 @@ public function htmlsearch(AjaxDungeonRouteSearchFormRequest $request, Expansion
'ratings', 'routeattributes', 'dungeon', 'dungeon.activeFloors', 'mappingVersion'])
->join('dungeons', 'dungeon_routes.dungeon_id', 'dungeons.id')
->join('mapping_versions', 'mapping_versions.dungeon_id', 'dungeons.id')
->when($expansion !== null, static fn(Builder $builder) =>
$builder->where('dungeons.expansion_id', $expansion->id)
->when($expansion !== null, static fn(Builder $builder) => $builder->where('dungeons.expansion_id', $expansion->id)
)
->when($season !== null, static fn(Builder $builder) =>
$builder->where('dungeon_routes.season_id', $season->id)
->when($season !== null, static fn(Builder $builder) => $builder->where('dungeon_routes.season_id', $season->id)
)
// Only non-try routes, combine both where() and whereNull(), there are inconsistencies where one or the
// other may work, this covers all bases for both dev and live
Expand Down Expand Up @@ -455,25 +455,34 @@ public function store(
): DungeonRoute {
$this->authorize('edit', $dungeonRoute);

$beforeDungeonRoute = null;

if ($dungeonRoute === null) {
$dungeonRoute = new DungeonRoute();
} else {
$beforeDungeonRoute = clone $dungeonRoute;
}

// Update or insert it
if (!$dungeonRoute->saveFromRequest($request, $seasonService, $expansionService, $thumbnailService)) {
abort(500, 'Unable to save dungeonroute');
}

$this->dungeonRouteChanged($dungeonRoute, $beforeDungeonRoute, $dungeonRoute);

return $dungeonRoute;
}

/**
* @throws AuthorizationException
* @throws Exception
*/
public function storePullGradient(Request $request, SeasonService $seasonService, DungeonRoute $dungeonRoute): Response
public function storePullGradient(Request $request, DungeonRoute $dungeonRoute): Response
{
$this->authorize('edit', $dungeonRoute);

$beforeDungeonRoute = clone $dungeonRoute;

$dungeonRoute->pull_gradient = $request->get('pull_gradient', '');
$dungeonRoute->pull_gradient_apply_always = $request->get('pull_gradient_apply_always', false);

Expand All @@ -482,6 +491,8 @@ public function storePullGradient(Request $request, SeasonService $seasonService
abort(500, 'Unable to save dungeonroute');
}

$this->dungeonRouteChanged($dungeonRoute, $beforeDungeonRoute, $dungeonRoute);

return response()->noContent();
}

Expand All @@ -496,6 +507,8 @@ public function delete(Request $request, DungeonRoute $dungeonRoute): Response
abort(500, 'Unable to delete dungeonroute');
}

$this->dungeonRouteChanged($dungeonRoute, $dungeonRoute, null);

return response()->noContent();
}

Expand All @@ -512,13 +525,17 @@ public function publishedState(PublishFormRequest $request, DungeonRoute $dungeo
abort(422, 'This sharing state is not available for this route');
}

$beforeDungeonRoute = clone $dungeonRoute;

$dungeonRoute->published_state_id = PublishedState::ALL[$publishedState];
if ($dungeonRoute->published_state_id === PublishedState::ALL[PublishedState::WORLD]) {
$dungeonRoute->published_at = date('Y-m-d H:i:s', time());
}

$dungeonRoute->save();

$this->dungeonRouteChanged($dungeonRoute, $beforeDungeonRoute, $dungeonRoute);

return response()->noContent();
}

Expand Down
26 changes: 11 additions & 15 deletions app/Http/Controllers/Ajax/AjaxEnemyPatrolController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,34 +35,30 @@ public function store(
): EnemyPatrol {
$validated = $request->validated();

$beforeModel = $enemyPatrol !== null ? clone $enemyPatrol : null;

return $this->storeModel(
$mappingVersion,
$validated,
EnemyPatrol::class,
$enemyPatrol,
function (EnemyPatrol $enemyPatrol) use ($coordinatesService, $validated) {
$changedFloor = null;
function (EnemyPatrol $enemyPatrol) use ($coordinatesService, $validated, $beforeModel) {
// A bit of a hack but disable the facade status of the mapping version - when editing an enemy patrol
// we use the admin panel, which NEVER uses the facade view since we're editing.
$enemyPatrol->mappingVersion->facade_enabled = false;

// Create a new polyline and save it
$polyline = $this->savePolyline(
$this->savePolylineToModel(
$coordinatesService,
null, // Disable saving changes - we don't need that
$enemyPatrol->mappingVersion,
Polyline::findOrNew($enemyPatrol->polyline_id),
$beforeModel,
$enemyPatrol,
$validated['polyline'],
$changedFloor
$validated['polyline']
);

// Couple the patrol to the polyline
$saveResult = $enemyPatrol->update([
'polyline_id' => $polyline->id,
'floor_id' => $changedFloor?->id ?? $enemyPatrol->floor_id,
]);

// Load the polyline, so it can be echoed back to the user
$enemyPatrol->load(['polyline']);

return $saveResult;
return true;
}
);
}
Expand Down
Loading
Loading