summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elm/StaffEdit/Main.elm7
-rw-r--r--lib/VNWeb/Staff/Edit.pm1
2 files changed, 6 insertions, 2 deletions
diff --git a/elm/StaffEdit/Main.elm b/elm/StaffEdit/Main.elm
index 423e088d..41044d5c 100644
--- a/elm/StaffEdit/Main.elm
+++ b/elm/StaffEdit/Main.elm
@@ -153,7 +153,7 @@ update msg model =
isValid : Model -> Bool
-isValid model = not model.aliasDup
+isValid model = not (model.aliasDup || List.any (\l -> l.name == l.original) model.alias)
view : Model -> Html Msg
@@ -163,7 +163,10 @@ view model =
tr []
[ td [ class "tc_id" ] [ inputRadio "main" (e.aid == model.aid) (AliasMain e.aid) ]
, td [ class "tc_name" ] [ inputText "" e.name (AliasName n) GSE.valAliasName ]
- , td [ class "tc_original" ] [ inputText "" e.original (AliasOrig n) GSE.valAliasOriginal ]
+ , td [ class "tc_original" ]
+ [ inputText "" e.original (AliasOrig n) GSE.valAliasOriginal
+ , if e.name /= "" && e.name == e.original then b [ class "standout" ] [ text "May not be the same as Name (romaji)" ] else text ""
+ ]
, td [ class "tc_add" ]
[ if model.aid == e.aid then b [ class "grayedout" ] [ text " primary" ]
else if e.inuse then b [ class "grayedout" ] [ text " referenced" ]
diff --git a/lib/VNWeb/Staff/Edit.pm b/lib/VNWeb/Staff/Edit.pm
index deb5e7fc..227da7f2 100644
--- a/lib/VNWeb/Staff/Edit.pm
+++ b/lib/VNWeb/Staff/Edit.pm
@@ -79,6 +79,7 @@ elm_api StaffEdit => $FORM_OUT, $FORM_IN, sub {
# The form validation only checks for duplicate aid's, but the name+original should also be unique.
my %names;
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.
validate_dbid