Error 500 when sending zero-length private messages

(David) #1

Action: hitting Reply on a private message.

FloatDomainError (NaN):
  lib/text_sentinel.rb:19:in `to_i'
  lib/text_sentinel.rb:19:in `body_sentinel'
  lib/validators/post_validator.rb:30:in `raw_quality'
  lib/validators/post_validator.rb:7:in `validate'
Happens when  

```` ruby 
SiteSetting.min_post_length == 0

Here is text_sentinel.rb: line 17
``` ruby

    if opts[:private_message]
      scale_entropy = SiteSetting.min_private_message_post_length.to_f / SiteSetting.min_post_length.to_f
      entropy = (entropy * scale_entropy).to_i        #  exception


(Régis Hanol) #2

Why would you want min_post_length to be 0?

(Jeff Atwood) #3

Agreed, this is not a valid setting.

(Jacob) #4

<–Need to blankpost–>

(David) #5

It’s a valid point. We sometimes use our boards for some sort of near instant messaging, and we sometimes use empty posts to Acknowledgement of some sort.

Perhaps there could be a warning in the site administration dashboard when min_post_length is 0?

@illspirit: how exactly did you do that ?

(Charles-Pierre) #6

In my community, empty posts are allowed and they do convey a lot of meaning. It is sort of a private joke meaning “I won’t bother replying, but be sure that I did not miss your post”.

It is definitely something we do use on a daily basis and that is deeply engrained in the culture of the board, as stupid as it sounds.

(Jacob) #7

People on my site blank post as an inside joke as well, it’s not that uncommon.

(Jeff Atwood) #8

Instead of replying with a meaningless empty post, click the like button on the post. That is the same as an individual confirmation.

Empty posts are not valid.

(Charles-Pierre) #9

I can’t speak for @masda70 and @illspirit, but on my board, likes and empty posts do not have the same meaning.
Especially, since likes is a measure of popularity (at least to us), we just can’t merge that with empty posts, because empty posts mean “you’re too stupid for me to answer”.

Is the official status of @masda70’s bug a WONTFIX?

If so, I hope you still acknowledge that on some boards blank posts are valid and are not frowned upon.

(Régis Hanol) #10

Well, then why even bother creating an empty post?

(Hrishikesh Thakre) #11

everything is fair in love and war :smile: and that question just started world war three :wink:

(Charles-Pierre) #12

Because sarcasm and disdain is definitely something users do all the time.
We’re a nice community but we like to poke each others sometimes. Anyway, as I said, it is a defining part of the community and if it is a WONTFIX I’ll have to find a way myself. I can’t imagine not allowing blank posts.

(Robin Ward) #13

I would say this is a WONTFIX. I’d be more than happy to help you make it a plugin though :smile:

(David) #14

@cpa: this is what we are looking for right?

(Sam Saffron) #15

The official state is this.

  • There is a legit bug here. We should NEVER allow users to set site settings that break the forum. Instead we should pop up a window that says minimum must be 1 or more.

  • This is an invalid use case and can cause severe sociological issues if enabled. Nonetheless, if you really really want it you may create a plugin that simply adds <!--boblablaw--> to any empty posts users attempt to post prior to submitting.

your mileage may vary, we may end up patching the <!--boblawblogs--> bug / feature

(Charles-Pierre) #16

Thanks for the clarification. @eviltrout thanks for helping out! Do you thinks that masda70’s mockup is doable through a plugin?

(Dan Porter) #17

I’m interested in the reason why a post can’t exist without content. Surely the bug lies with creating the post? Although a rare use case (as the guys above have just demonstrated) I don’t see how this is infeasible.

(Robin Ward) #18

Yup. The easier way would be just to accept posts with 0 content. I would do this by transforming it myself the way sam suggested.

The button is trickier and might require some API hooks from us but is totally doable.

(Jeff Atwood) #19