Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick Edit compatibility #29

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading