* Do not reinsert the existing wiki page when uploading an attachment. Fixes bug...
authorArt Cancro <ajc@citadel.org>
Fri, 12 Mar 2010 16:58:54 +0000 (16:58 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 12 Mar 2010 16:58:54 +0000 (16:58 +0000)
webcit/msg_renderers.c

index 9f35f867303dd70fabb0d8abee2ee6be104d1e09..03b8191525a59ec1cad975e9328525a2d3d4f31b 100644 (file)
@@ -833,12 +833,18 @@ void tmplput_EDIT_WIKI_BODY(StrBuf *Target, WCTemplputParams *TP)
         long msgnum;
        StrBuf *Buf;
 
-       msgnum = locate_message_by_uid(BSTR("page"));
-       if (msgnum >= 0L) {
-               Buf = NewStrBuf();
-               read_message(Buf, HKEY("view_message_wikiedit"), msgnum, NULL, &Mime);
-               StrBufAppendTemplate(Target, TP, Buf, 1);
-               FreeStrBuf(&Buf);
+       /* Insert the existing content of the wiki page into the editor.  But we only want
+        * to do this the first time -- if the user is uploading an attachment we don't want
+        * to do it again.
+        */
+       if (!havebstr("attach_button")) {
+               msgnum = locate_message_by_uid(BSTR("page"));
+               if (msgnum >= 0L) {
+                       Buf = NewStrBuf();
+                       read_message(Buf, HKEY("view_message_wikiedit"), msgnum, NULL, &Mime);
+                       StrBufAppendTemplate(Target, TP, Buf, 1);
+                       FreeStrBuf(&Buf);
+               }
        }
 }