Skip to content

Commit

Permalink
fix(characters): fix character warning array mapping (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScuffedNewt authored Sep 26, 2024
1 parent 2b135f0 commit 7b30804
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ public function getContentWarnings() {

return ['warning' => ucwords($lower)];
});
})->collapse()->unique()->sort()->toJson();
})->sort()->flatten(1)->unique()->values()->toJson();

return $contentWarnings;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Character/CharacterImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public function getEditWarningsAttribute() {

return ['warning' => ucwords($lower)];
});
})->collapse()->sort()->toJson();
})->sort()->flatten(1)->values()->toJson();

return $contentWarnings;
}
Expand Down
3 changes: 1 addition & 2 deletions resources/views/widgets/_character_warning_js.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
options: options,
onInitialize: function() {
console.log(this.$input.attr('data-init-value'));
var existingOptions = JSON.parse(this.$input.attr(
'data-init-value'));
let existingOptions = this.$input.attr('data-init-value') ? JSON.parse(this.$input.attr('data-init-value')) : [];
var self = this;
if (Object.prototype.toString.call(existingOptions) ===
"[object Array]") {
Expand Down

0 comments on commit 7b30804

Please sign in to comment.