# Are very long words not allowed in topic titles?

**URL:** https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683
**Category:** Bug
**Tags:** email
**Created:** [5 ביוני,‏ 2015,‏ 12:33pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683 "2015-06-05T12:33:20Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [5 ביוני,‏ 2015,‏ 12:33pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/1 "2015-06-05T12:33:20Z")

</div>

We had a user get an email-in topic rejected with the topic:

> `Adding DropMillisecondsHibernateInterceptor for MySQL 5.6+ compatibility`

With the error message: `Title is invalid; try to be a little more descriptive`.

However, when he changed the title to:

> `Adding an interceptor to drop milliseconds for compatibility with MySQL 5.6 and above`

The topic was accepted & processed.

1. Does `+` really cause an email to be rejected? Must it be?
2. If it must, can we at least get a more accurate error message?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [5 ביוני,‏ 2015,‏ 1:43pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/2 "2015-06-05T13:43:47Z")

</div>

I’m pretty sure that the issue is “`DropMillisecondsHibernateInterceptor`” (a very long word) and not the “`+`”.

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [5 ביוני,‏ 2015,‏ 2:04pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/3 "2015-06-05T14:04:39Z")

</div>

Should disabling the **title prettify** site setting prevent long words from triggering an error?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5 ביוני,‏ 2015,‏ 11:18pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/4 "2015-06-05T23:18:05Z")

</div>

It might, we detect long unbroken sequences of characters as griefing in titles.

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [7 ביוני,‏ 2015,‏ 2:44pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/5 "2015-06-07T14:44:25Z")

</div>

Nevertheless, could the error message be changed to be more specific and better represent what users need to do to post their message? In this case, making it more descriptive would not help.

---

<div class="post-metadata">

### Author: ![fenec](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fenec/32/43043_2.png) [@fenec](https://meta.discourse.org/u/fenec)
#### Post date: [14 ביוני,‏ 2015,‏ 6:17pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/6 "2015-06-14T18:17:34Z")

</div>

I think refactoring TextSentinel to make it show meaningful error messages for all kinds of ‘invalid’ titles and posts would be great.

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [14 ביוני,‏ 2015,‏ 9:40pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/7 "2015-06-14T21:40:14Z")

</div>

Yes, absolutely. Right now the ambiguous error messages just confuse and frustrate users.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [14 ביוני,‏ 2015,‏ 9:50pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/8 "2015-06-14T21:50:46Z")

</div>

I just test by changing the default  
`max topic title length`  
from 255 to 25.

I must be missing something, this error message doesn’t seem at all ambiguous to me.

![](https://global.discourse-cdn.com/meta/original/3X/5/7/5735a30877e0456249ef7503d5956a0f3128b531.png)

---

<div class="post-metadata">

### Author: ![AmiAthena](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/amiathena/32/116030_2.png) [@AmiAthena](https://meta.discourse.org/u/AmiAthena)
#### Post date: [14 ביוני,‏ 2015,‏ 9:56pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/9 "2015-06-14T21:56:50Z")

</div>

I think the problem is long words, not long titles.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [14 ביוני,‏ 2015,‏ 10:04pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/10 "2015-06-14T22:04:41Z")

</div>

Thanks, now I see.

I tried this for a Title  
`thisisonesuperexceptionallylongwordbeingusedasatitletoseeifitthrowsanerrorandifsowhatthaterrormessageis`

And got this

![](https://global.discourse-cdn.com/meta/original/3X/2/0/20215c0ccd5930fac705333f75acb0e7213528fa.png)

Ironic, isn’t it?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [14 ביוני,‏ 2015,‏ 10:27pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/11 "2015-06-14T22:27:59Z")

</div>

It seems this does indeed involve text\_sentinel.rb  
It tests different things that a FAIL in any result in the same “invalid” message.

```plaintext
  def self.body_sentinel(text, opts={})
    entropy = SiteSetting.body_min_entropy
    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
      entropy = (SiteSetting.min_private_message_post_length.to_f * ENTROPY_SCALE).to_i if entropy > SiteSetting.min_private_message_post_length
    else
      entropy = (SiteSetting.min_post_length.to_f * ENTROPY_SCALE).to_i if entropy > SiteSetting.min_post_length
    end
    TextSentinel.new(text, min_entropy: entropy)
  end

  def self.title_sentinel(text)
    entropy = if SiteSetting.min_topic_title_length > SiteSetting.title_min_entropy
      SiteSetting.title_min_entropy
    else
      (SiteSetting.min_topic_title_length.to_f * ENTROPY_SCALE).to_i
    end
    TextSentinel.new(text, min_entropy: entropy, max_word_length: SiteSetting.title_max_word_length)
  end

  # Entropy is a number of how many unique characters the string needs.
  # Non-ASCII characters are weighted heavier since they contain more "information"
  def entropy
    chars = @text.to_s.strip.split('')
    @entropy ||= chars.pack('M*'*chars.size).gsub("\n",'').split('=').uniq.size
  end

  def valid?
    @text.present? &&
    seems_meaningful? &&
    seems_pronounceable? &&
    seems_unpretentious? &&
    seems_quiet?
  end

  private

  def symbols_regex
    /[\ -\/\[-\`\:-\@\{-\~]/m
  end

  def seems_meaningful?
    # Minimum entropy if entropy check required
    @opts[:min_entropy].blank? || (entropy >= @opts[:min_entropy])
  end

  def seems_pronounceable?
    # At least some non-symbol characters
    # (We don't have a comprehensive list of symbols, but this will eliminate some noise)
    @text.gsub(symbols_regex, '').size > 0
  end

  def seems_unpretentious?
    # Don't allow super long words if there is a word length maximum
    @opts[:max_word_length].blank? || @text.split(/\s|\/|-|\./).map(&:size).max <= @opts[:max_word_length]
  end

  def seems_quiet?
    # We don't allow all upper case content in english
    not((@text =~ /[A-Z]+/) && !(@text =~ /[^[:ascii:]]/) && (@text == @text.upcase))
  end

end

```

It would require code changes to have more specific error messages.

Maybe easier to just have the message point out the possible FAIL reasons and let users figure out which one was the problem?

Though I guess a better error message alone wouldn’t solve the OP problem if such was a necessity to use in the email.

---

<div class="post-metadata">

### Author: ![fenec](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fenec/32/43043_2.png) [@fenec](https://meta.discourse.org/u/fenec)
#### Post date: [14 ביוני,‏ 2015,‏ 11:06pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/12 "2015-06-14T23:06:22Z")

</div>

I made a fix:  
[https://github.com/fenec/discourse/commit/849da848c14c5bc913609d45fcfcb0d90895fe99](https://github.com/fenec/discourse/commit/849da848c14c5bc913609d45fcfcb0d90895fe99)  
Would be great to have some better wordings for errors.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [15 ביוני,‏ 2015,‏ 4:23am UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/13 "2015-06-15T04:23:01Z")

</div>

That is not really the intent of this feature. We view it as anti-griefing, and telling griefers how to bypass filters is like Google telling spammers exactly what they didn’t like about their emails.

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [15 ביוני,‏ 2015,‏ 2:52pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/14 "2015-06-15T14:52:08Z")

</div>

> [@codinghorror](#):
>
> We view it as anti-griefing

The only grief happening for us is on behalf of our legitimate users who can’t figure out how to successfully post topics. ☹

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [15 ביוני,‏ 2015,‏ 3:29pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/15 "2015-06-15T15:29:40Z")

</div>

Have you tried tweaking your  
Admin → Settings → Posting  
settings?

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [15 ביוני,‏ 2015,‏ 4:02pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/16 "2015-06-15T16:02:18Z")

</div>

Yes, for other issues. But AFAICT none of those settings relate to the issue raised in this bug.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [15 ביוני,‏ 2015,‏ 9:07pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/17 "2015-06-15T21:07:01Z")

</div>

What about this one?

> [@Mittineague](#):
>
> SiteSetting.title\_max\_word\_length

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [1 בינואר,‏ 2016,‏ 3:43pm UTC](https://meta.discourse.org/t/are-very-long-words-not-allowed-in-topic-titles/29683/18 "2016-01-01T15:43:48Z")

</div>


