summaryrefslogtreecommitdiff
path: root/elm/VNEdit.elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-08-03 15:24:34 +0200
committerYorhel <git@yorhel.nl>2020-08-03 15:24:34 +0200
commitc5d0b1a92b301dde6df1ee707304685874131d8a (patch)
treeb1f08d5608b0964c95a3ab86ad279f155a129eda /elm/VNEdit.elm
parenta5204cdee31f5130330312eeaf7c31fab2504f89 (diff)
VNEdit: Check for release titles added as alias
Diffstat (limited to 'elm/VNEdit.elm')
-rw-r--r--elm/VNEdit.elm20
1 files changed, 18 insertions, 2 deletions
diff --git a/elm/VNEdit.elm b/elm/VNEdit.elm
index 0397b492..4fadbf2d 100644
--- a/elm/VNEdit.elm
+++ b/elm/VNEdit.elm
@@ -280,9 +280,17 @@ update msg model =
Submitted r -> ({ model | state = Api.Error r }, Cmd.none)
+-- TODO: Fuzzier matching? Exclude stuff like 'x Edition', etc.
+relAlias : Model -> Maybe GVE.RecvReleases
+relAlias model =
+ let a = String.toLower model.alias |> String.lines |> List.filter (\l -> l /= "") |> Set.fromList
+ in List.filter (\r -> Set.member (String.toLower r.title) a || Set.member (String.toLower r.original) a) model.releases |> List.head
+
+
isValid : Model -> Bool
isValid model = not
( (model.title /= "" && model.title == model.original)
+ || relAlias model /= Nothing
|| not (Img.isValid model.image)
|| List.any (\(_,i,r) -> r == Nothing || not (Img.isValid i)) model.screenshots
|| hasDuplicates (List.map (\s -> (s.aid, s.role)) model.staff)
@@ -313,8 +321,16 @@ view model =
, br [] []
, if hasDuplicates <| String.lines <| String.toLower model.alias
then b [ class "standout" ] [ text "List contains duplicate aliases.", br [] [] ]
- else text ""
- -- TODO: Warn when release titles are entered?
+ else
+ case relAlias model of
+ Nothing -> text ""
+ Just r -> span []
+ [ b [ class "standout" ] [ text "Release titles should not be added as alias." ]
+ , br [] []
+ , text "Release: "
+ , a [ href <| "/r"++String.fromInt r.id ] [ text r.title ]
+ , br [] [], br [] []
+ ]
, text "List of alternative titles or abbreviations. One line for each alias. Can include both official (japanese/english) titles and unofficial titles used around net."
, br [] []
, text "Titles that are listed in the releases should not be added here!"