-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GitHub account SSH key checking #153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great! I only added some style/linting suggestions to take as you will!
apps/client/src/client/views.clj
Outdated
@@ -24,7 +24,7 @@ | |||
[:header#top | |||
[:h1 [:a.home {:href "/"} "sharing.io"]] | |||
[:nav | |||
(when permitted-member | |||
(when (and permitted-member (not (empty? (:ssh-keys user))))(not= (:ssh-keys user) nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In clojure, if you call empty?
on a string, it will return true if string == ""
or string == nil
.
So this conditional could be simplified to:
(when (and permitted-member (not (empty? (:ssh-keys user)))))
However, there's an option to simplify it further using a clojure idiom. Instead o calling (not (empty? val))
you can just say (seq val)
, as it will return nil if the value is ""
or nil
, and nil is a falsy value for the purpose of this conditional statement.
In that case, the code could be reduced to:
(when (and permitted-member (seq (:ssh-keys user)))
...do-stuff)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! The (not= (:ssh-keys user) nil)
might've been from when I was testing around things.
Testing it with (seq ...)
works very well! Geez, that's so simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in c18eedb
Fixes #134