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

[ticket/12025] Post Preview no longer shows warnings #2360

Merged
merged 4 commits into from May 8, 2014

Conversation

Nicofuma
Copy link
Member

@prototech
Copy link
Contributor

The reason $preview was added was so that you wouldn't get any errors after clicking "Full editor & Preview" in the quick reply form. This behavior should be retained while also fixing the reported bug.

@Nicofuma
Copy link
Member Author

I don't understand why it is annoying if we get "You cannot use certain BBCodes: [url]." when clicking "Full editor & Preview".

@bantu
Copy link
Collaborator

bantu commented Apr 27, 2014

@prototech I disagree. Clicking "Full editor & Preview" clearly asks for the Preview and any errors that the BBcode might produce. This clearly is a regression from https://tracker.phpbb.com/browse/PHPBB3-10726 to me. Also see #670 (comment)

@nickvergessen
Copy link
Contributor

I agree with bantu here

@prototech
Copy link
Contributor

My memory seems to be failing me. ;) It was added specifically so that you wouldn't get the "Your message contains too few characters." error when clicking on the button with no message entered since the user is simply transitioning to the full editor. See: 5ccd691

@nickvergessen
Copy link
Contributor

Well then make this one message not display on the "go to full editor" button, but all others should display?

@prototech
Copy link
Contributor

Agreed.

@bantu
Copy link
Collaborator

bantu commented Apr 27, 2014

Just don't call the parser at all when the message is empty?

@Nicofuma
Copy link
Member Author

We can also change the condition to if (sizeof($message_parser->warn_msg) && $refresh && (!$preview || ($preview && empty($message_parser->message))))

@Nicofuma
Copy link
Member Author

The last sub-condition $preview && empty($message_parser->message) could also be around the call to the parser. As you want.

@@ -879,10 +879,13 @@
$message_parser->warn_msg = array();
}

$message_parser->parse($post_data['enable_bbcode'], ($config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']);
if (! ($preview && empty($message_parser->message)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move the ! into the brackets

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply DeMorgan.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!$preview || !empty($message_parser->message))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

nickvergessen added a commit to nickvergessen/phpbb that referenced this pull request May 8, 2014
[ticket/12025] Post Preview no longer shows warnings

* Nicofuma/ticket/12025:
  [ticket/12025] Apply DeMorgan
  [ticket/12025] Fixing the condition....
  [ticket/12025] Don't show any error on preview if the message is empty
  [ticket/12025] Post Preview no longer shows warnings
@nickvergessen nickvergessen merged commit 0061067 into phpbb:develop-ascraeus May 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants