diff Comments.lua @ 263:03f1fbe64104

The Submit button now attaches comments to the appropriate DB entries.
author James D. Callahan III <jcallahan@curse.com>
date Tue, 19 Mar 2013 14:51:50 -0500
parents 7f5982e01953
children 58b090074eda
line wrap: on
line diff
--- a/Comments.lua	Tue Mar 19 12:54:21 2013 -0500
+++ b/Comments.lua	Tue Mar 19 14:51:50 2013 -0500
@@ -14,6 +14,7 @@
 
 local ParseGUID = private.ParseGUID
 local ItemLinkToID = private.ItemLinkToID
+local DBEntry = private.DBEntry
 
 -- CONSTANTS ----------------------------------------------------------
 
@@ -257,7 +258,15 @@
     submit:Enable(false)
 
     submit:SetScript("OnClick", function()
-    -- TODO: Make this assign the comment to the correct SavedVariables entry.
+        local entry = DBEntry(URL_TYPE_MAP[comment_subject.type_name], comment_subject.id)
+
+        if not entry then
+            WDP:Print("An error has occurred; please report at http://wow.curseforge.com/addons/wowdb-profiler/create-ticket/")
+            return
+        end
+        entry.comments = entry.comments or {}
+        entry.comments[#entry.comments + 1] = edit_box:GetText()
+
         edit_box:SetText("")
         _G.HideUIPanel(panel)
     end)