Skip to content

Commit e3fd198

Browse files
authored
Merge pull request #351 from topcoder-platform/issues-347
Issues-347: fixed cancel url for draft
2 parents c1db08c + cab4194 commit e3fd198

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

vanilla/applications/vanilla/controllers/class.postcontroller.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)