Skip to content

Commit

Permalink
Sharing via Twitter fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dbyrne committed May 20, 2011
1 parent 0402c22 commit ad8253c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/foreclojure/social.clj
Expand Up @@ -26,9 +26,13 @@
(def clojure-hashtag (throttled (constantly " #clojure")
(* 1000 60 60))) ; hourly

(defn tweet-link [status & [anchor-text]]
(str "<a href=\"http://twitter.com/home?status="
(URLEncoder/encode status) "\">"
(defn tweet-link [id status & [anchor-text]]
(str "<a href=\"http://twitter.com/share?"
"text=" (URLEncoder/encode status)
"&url=" (URLEncoder/encode
(str "https://4clojure.com/problem/" id))
"&related=4clojure"
"\">"
(or anchor-text "Twitter")
"</a>"))

Expand All @@ -51,9 +55,9 @@
(catch Throwable _ nil))))

(defn tweet-solution [id gist-url & [link-text]]
(let [status-msg (str "Check out how I solved https://4clojure.com/problem/"
id " - " gist-url " #4clojure" (clojure-hashtag))]
(tweet-link status-msg link-text)))
(let [status-msg (str "Check out how I solved problem #"
id " on #4clojure " (clojure-hashtag) " " gist-url)]
(tweet-link id status-msg link-text)))

(def-page share-page []
(if-let [[id code] (session/session-get :code)]
Expand Down

0 comments on commit ad8253c

Please sign in to comment.