From a28ef48931c024b76bbde61a945031a71936444a Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 14 Aug 2018 02:21:51 -0400 Subject: [PATCH] Solution for intro/part6 --- intro/part6/src/Avatar.elm | 10 +++++----- intro/part6/src/Page/Article/Editor.elm | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/intro/part6/src/Avatar.elm b/intro/part6/src/Avatar.elm index 0eac0dd..a2938f3 100644 --- a/intro/part6/src/Avatar.elm +++ b/intro/part6/src/Avatar.elm @@ -40,12 +40,12 @@ src (Avatar maybeUrl) = resolveAvatarUrl : Maybe String -> String resolveAvatarUrl maybeUrl = - {- 👉 TODO #1 of 2: return the user's avatar from maybeUrl, if maybeUrl actually - contains one. If maybeUrl is Nothing, return this URL instead: + case maybeUrl of + Just url -> + url - https://static.productionready.io/images/smiley-cyrus.jpg - -} - "" + Nothing -> + "https://static.productionready.io/images/smiley-cyrus.jpg" encode : Avatar -> Value diff --git a/intro/part6/src/Page/Article/Editor.elm b/intro/part6/src/Page/Article/Editor.elm index 04a89e4..d36b864 100644 --- a/intro/part6/src/Page/Article/Editor.elm +++ b/intro/part6/src/Page/Article/Editor.elm @@ -572,6 +572,7 @@ toTagList tagString = -} String.split " " tagString |> List.map String.trim + |> List.filter (\str -> str /= "") edit : Slug -> TrimmedForm -> Cred -> Http.Request (Article Full)