@@ -443,6 +443,9 @@ public function editDiscussion($discussionID = '', $draftID = '') {
443443 $ record = $ this ->Draft = $ this ->DraftModel ->getID ($ draftID );
444444 $ this ->CategoryID = $ this ->Draft ->CategoryID ;
445445 $ this ->setData ('ShowPreviewButton ' , $ record ->Format != 'Rich ' );
446+
447+ // FIX: https://github.com/topcoder-platform/forums/issues/347
448+ $ this ->setData ('_CancelUrl ' , '/drafts ' );
446449 // Verify this is their draft
447450 if (val ('InsertUserID ' , $ this ->Draft ) != Gdn::session ()->UserID ) {
448451 throw permissionException ();
@@ -455,6 +458,7 @@ public function editDiscussion($discussionID = '', $draftID = '') {
455458 $ this ->fireEvent ('BeforeEditDiscussion ' );
456459 $ this ->setData ('Discussion ' , $ record , true );
457460 $ this ->CategoryID = $ this ->Discussion ->CategoryID ;
461+ $ this ->setData ('_CancelUrl ' , discussionUrl ($ this ->data ('Discussion ' )));
458462 }
459463
460464 // Normalize the edit data.
@@ -467,8 +471,6 @@ public function editDiscussion($discussionID = '', $draftID = '') {
467471 $ this ->Form ->removeFormValue ('Format ' );
468472 }
469473
470- $ this ->setData ('_CancelUrl ' , discussionUrl ($ this ->data ('Discussion ' )));
471-
472474 // Set view and render
473475 $ this ->View = 'Discussion ' ;
474476 $ this ->discussion ($ this ->CategoryID );
0 commit comments