aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2024-03-21 15:49:25 +0100
committerMiquel Sabaté Solà <msabate@suse.com>2024-03-21 15:49:25 +0100
commite2f65c0c3cc786865d7e6c4c6118221ee4ca277b (patch)
treed95442eb3257bf634ce37a52364340490bde5758
parent819f299d3bdc2485394120583b8a76a67b10b418 (diff)
downloadoperum-e2f65c0c3cc786865d7e6c4c6118221ee4ca277b.tar.gz
operum-e2f65c0c3cc786865d7e6c4c6118221ee4ca277b.zip
things: use replaceAll when trimming authors
We were using just `#replace`, which gives us some bad results which were easily fixed via `#replaceAll`. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
-rw-r--r--app/javascript/controllers/thing_controller.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/controllers/thing_controller.js b/app/javascript/controllers/thing_controller.js
index ca957ba..615e466 100644
--- a/app/javascript/controllers/thing_controller.js
+++ b/app/javascript/controllers/thing_controller.js
@@ -46,7 +46,7 @@ export default class extends Controller {
if (idx > -1) {
let idx2 = author.indexOf('_', idx + 1);
if (idx2 > -1) {
- return author.substring(idx + 1, idx2).replace(' ', '');
+ return author.substring(idx + 1, idx2).replaceAll(' ', '');
}
}
@@ -54,7 +54,7 @@ export default class extends Controller {
// name.
return author
.split(' ').pop().trim() // Pick the last element.
- .replace('-', ''); // "Last-Other" => "LastOther"
+ .replaceAll('-', ''); // "Last-Other" => "LastOther"
}
// Update the information we get from the year field so to autocomplete it