summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Staff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-06-20 09:22:01 +0200
committerYorhel <git@yorhel.nl>2020-06-20 09:22:07 +0200
commit76e3fd59690cae97321600a0b4722a416ea4f788 (patch)
tree0a39a2b36befc752d7bd09d8bbfef95c6f8e545e /lib/VNWeb/Staff
parent3d001e65f9f9ecb1825feb5416542453d471954c (diff)
Staff::Edit: Fix re-adding aliases by reverting
A revert will retain the original alias ID, which was incorrectly rejected during validation.
Diffstat (limited to 'lib/VNWeb/Staff')
-rw-r--r--lib/VNWeb/Staff/Edit.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/VNWeb/Staff/Edit.pm b/lib/VNWeb/Staff/Edit.pm
index 1ab4ce2f..98b90d9f 100644
--- a/lib/VNWeb/Staff/Edit.pm
+++ b/lib/VNWeb/Staff/Edit.pm
@@ -91,9 +91,9 @@ elm_api StaffEdit => $FORM_OUT, $FORM_IN, sub {
die "Duplicate aliases" if grep $names{"$_->{name}\x00$_->{original}"}++, $data->{alias}->@*;
die "Original = name" if grep $_->{name} eq $_->{original}, $data->{alias}->@*;
- # For positive alias IDs: Make sure they exist and are owned by this entry.
+ # For positive alias IDs: Make sure they exist and are (or were) owned by this entry.
validate_dbid
- sql('SELECT aid FROM staff_alias WHERE id =', \$e->{id}, 'AND aid IN'),
+ sql('SELECT aid FROM staff_alias_hist WHERE chid IN(SELECT id FROM changes WHERE type = \'s\' AND itemid =', \$e->{id}, ') AND aid IN'),
grep $_>=0, map $_->{aid}, $data->{alias}->@*;
# For negative alias IDs: Assign a new ID.