Fixed a bug where child actionables could have a bad click handler due to a shallow copy.

Fixed missing localization strings.
This commit is contained in:
Joseph Milazzo 2025-06-08 04:55:38 -05:00
parent b4345b00a2
commit b372efaada
3 changed files with 14 additions and 6 deletions

View file

@ -1117,7 +1117,10 @@ export class ActionFactoryService {
if (action.children === null || action.children?.length === 0) return;
action.children?.forEach((childAction) => {
// Ensure action children are a copy of the parent (since parent does a shallow mapping)
action.children = action.children.map(d => { return {...d}; });
action.children.forEach((childAction) => {
this.applyCallback(childAction, callback, shouldRenderFunc);
});
}
@ -1125,10 +1128,13 @@ export class ActionFactoryService {
public applyCallbackToList(list: Array<ActionItem<any>>,
callback: ActionCallback<any>,
shouldRenderFunc: ActionShouldRenderFunc<any> = this.dummyShouldRender): Array<ActionItem<any>> {
// Create a clone of the list to ensure we aren't affecting the default state
const actions = list.map((a) => {
return { ...a };
});
actions.forEach((action) => this.applyCallback(action, callback, shouldRenderFunc));
return actions;
}

View file

@ -3,7 +3,6 @@ import {NgbActiveModal} from "@ng-bootstrap/ng-bootstrap";
import {ToastrService} from "ngx-toastr";
import {FormControl, FormGroup, ReactiveFormsModule} from "@angular/forms";
import {translate, TranslocoDirective} from "@jsverse/transloco";
import {ReadingList} from "../../../_models/reading-list";
import {ReadingProfileService} from "../../../_services/reading-profile.service";
import {ReadingProfile} from "../../../_models/preferences/reading-profiles";
import {FilterPipe} from "../../../_pipes/filter.pipe";
@ -66,7 +65,7 @@ export class BulkSetReadingProfileComponent implements OnInit, AfterViewInit {
addToProfile(profile: ReadingProfile) {
if (this.seriesIds.length == 1) {
this.readingProfileService.addToSeries(profile.id, this.seriesIds[0]).subscribe(() => {
this.toastr.success(translate('toasts.series-added-to-reading-profile', {name: profile.name}));
this.toastr.success(translate('toasts.series-bound-to-reading-profile', {name: profile.name}));
this.modal.close();
});
return;
@ -74,7 +73,7 @@ export class BulkSetReadingProfileComponent implements OnInit, AfterViewInit {
if (this.seriesIds.length > 1) {
this.readingProfileService.bulkAddToSeries(profile.id, this.seriesIds).subscribe(() => {
this.toastr.success(translate('toasts.series-added-to-reading-profile', {name: profile.name}));
this.toastr.success(translate('toasts.series-bound-to-reading-profile', {name: profile.name}));
this.modal.close();
});
return;
@ -82,7 +81,7 @@ export class BulkSetReadingProfileComponent implements OnInit, AfterViewInit {
if (this.libraryId) {
this.readingProfileService.addToLibrary(profile.id, this.libraryId).subscribe(() => {
this.toastr.success(translate('toasts.library-added-to-reading-profile', {name: profile.name}));
this.toastr.success(translate('toasts.library-bound-to-reading-profile', {name: profile.name}));
this.modal.close();
});
}

View file

@ -2676,7 +2676,8 @@
"match-success": "Series matched correctly",
"webtoon-override": "Switching to Webtoon mode due to images representing a webtoon.",
"scrobble-gen-init": "Enqueued a job to generate scrobble events from past reading history and ratings, syncing them with connected services.",
"series-added-to-reading-profile": "Series added to Reading Profile {{name}}"
"series-bound-to-reading-profile": "Series bound to Reading Profile {{name}}",
"library-bound-to-reading-profile": "Library bound to Reading Profile {{name}}"
},
"read-time-pipe": {
@ -2732,7 +2733,9 @@
"reading-profiles": "Reading Profiles",
"set-reading-profile": "Set Reading Profile",
"set-reading-profile-tooltip": "Bind a Reading Profile to this Library",
"clear-reading-profile": "Clear Reading Profile",
"clear-reading-profile-tooltip": "Clear Reading Profile for this Library",
"cleared-profile": "Cleared Reading Profile",
"others": "Others",