From 5070ee3f46a7b9cd796594736ebd48d8270a7ff6 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 3 Aug 2017 20:15:19 +0200 Subject: GitHubCommit.hs: Select row corresponding to correct channel Ask for the row corresponding to the channel received from the chat message. This gets rid of the previously hard-coded SQL and allows us to dynamically get the right URL value. --- src/Plugin/GitHubCommit.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Plugin/GitHubCommit.hs') diff --git a/src/Plugin/GitHubCommit.hs b/src/Plugin/GitHubCommit.hs index a12087c..2786ca6 100644 --- a/src/Plugin/GitHubCommit.hs +++ b/src/Plugin/GitHubCommit.hs @@ -18,9 +18,12 @@ gitHubCommit = Plugin gitHubCommitAction :: PluginAction gitHubCommitAction message dbConn = do - rs <- query_ dbConn "SELECT channel, repo_url \ + rs <- query dbConn "SELECT channel, repo_url \ \ FROM plugin_github_commit_channel_repo_urls \ - \ LIMIT 1" :: IO [ChannelRepoUrl] + \ WHERE channel = ? \ + \ LIMIT 1" + (Only (M.channel message)) + :: IO [ChannelRepoUrl] return $ response rs where response [] = "" -- cgit v1.2.3