Skip to content

Commit

Permalink
Merge pull request #29 from iMattPro/updates
Browse files Browse the repository at this point in the history
Quick Edit compatibility
  • Loading branch information
iMattPro authored Mar 20, 2024
2 parents 4358ed6 + 29bd50e commit f51821d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected function get_selected_prefix($event)
$prefix_id = $this->request->variable('topic_prefix', 0);

// If we are in preview mode, send back the prefix from the form
if (!empty($event['preview']))
if (!empty($event['preview']) && $event['mode'] !== 'edit')
{
return $prefix_id;
}
Expand Down
24 changes: 24 additions & 0 deletions tests/event/listener_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,18 @@ public function data_add_to_posting_form()
'SELECTED_PREFIX' => '[foo]',
),
),
array( // test adding selected prefix when previewing a new topic
$prefix_data,
array(
'mode' => 'post',
'preview' => true,
),
1,
array(
'PREFIXES' => $prefix_data,
'SELECTED_PREFIX' => '[foo]',
),
),
array( // test adding null selected prefix when posting new topic with bad data
$prefix_data,
array('mode' => 'post'),
Expand All @@ -223,6 +235,18 @@ public function data_add_to_posting_form()
'SELECTED_PREFIX' => '',
),
),
array( // test adding null selected prefix when previewing new topic with bad data
$prefix_data,
array(
'mode' => 'post',
'preview' => true,
),
2,
array(
'PREFIXES' => $prefix_data,
'SELECTED_PREFIX' => '',
),
),
array( // test post preview mode shows the expected prefix when no prefix is selected
$prefix_data,
array(
Expand Down

0 comments on commit f51821d

Please sign in to comment.