* merge trails function added * fix conflict resolve issues * avoid incorrect authorship when merging trail comments * require edit access for all selected trails before merge * fix likes checkbox binding in trail merge modal * improve error handling * require editable target and deletable sources for merge * avoid duplicate trail fetch during merge * prevent duplicate likes when merging trails * check photo download responses during trail merge * add merge completion toast notifications * cleanup * small fixes * move merge code to backend, option to merge single trail selection with similar one, automatic merge for integrations add as option, maintenance page to find and merge similar trails added * fix build error * fix * docu, beautifying, refactoring --------- Co-authored-by: Flomp <Flomp@users.noreply.github.com>
27 lines
759 B
TypeScript
27 lines
759 B
TypeScript
import { get } from "svelte/store";
|
|
import { _ } from "svelte-i18n";
|
|
|
|
const mergeErrorCodes = new Set([
|
|
"trail_merge_auth_required",
|
|
"trail_merge_actor_not_found",
|
|
"trail_merge_invalid_request",
|
|
"trail_merge_unknown_suggest_mode",
|
|
"trail_merge_missing_actor",
|
|
"trail_merge_missing_trail_id",
|
|
"trail_merge_same_source_target",
|
|
"trail_merge_requires_multiple_trails",
|
|
"trail_merge_missing_source_trail_id",
|
|
"trail_merge_source_actor_mismatch",
|
|
"trail_merge_source_not_found",
|
|
"trail_merge_target_not_found",
|
|
"trail_merge_not_allowed",
|
|
]);
|
|
|
|
export function translateTrailMergeError(message: string): string {
|
|
if (mergeErrorCodes.has(message)) {
|
|
return get(_)(message);
|
|
}
|
|
|
|
return message;
|
|
}
|