/* global SolidAuthClient, SolidUtils, $rdf */

TweeFiUtils = {

    TweetUri: class {
        constructor(value) {
            // Regex-pattern to check URLs against: 
            // https://twitter.com/<twitteruser>/status/<long number>
            var urlRegex = /^https:\/\/twitter.com\/([a-zA-Z _.,!"'/$]+)\/status\/([0-9]*$)/;
            this.match = urlRegex.exec(value);
            this.value = value;
        }

        isValid() {
            return this.match !== null;
        }

        getUser() {
            return this.match[1];
        }

        getStatus() {
            return this.match[2];
        }

        toString() {
            return this.value;
        }
    },
    updateLoginInfo() {
        SolidAuthClient.currentSession().then(function (session) {
            var user = $rdf.sym(session.webId);
            SolidUtils.rdfFetch(session.webId).then(function (response) {
                var name = response.graph.any(user, SolidUtils.vocab.foaf('name'));
                $("#loginInfo").html("Logged in as:");
                $("#loginName").html("<a class='nav-link' href='" + session.webId + "'>" + name + "</a>");
            });
        });
    }

}
@@ -775,24 +775,51 @@
 (session) %7B%0A
+            if (session) %7B%0A
             
@@ -1186,24 +1186,102 @@
         %7D);%0A
+        %7D else %7B%0A            $(%22#loginInfo%22).html(%22Not logged in%22);%0A        %7D%0A
         %7D);%0A

Check when session is null