How does `educate_until_posts` interact with the recent changes to `check_education_message`?

Continuing the discussion from “Thanks for Contributing” Popup in Posts Appearing Even After Limit Passed?:

I have a question about this change. I feel like I’m missing something or misunderstanding how this is supposed to work when testing it.

My expectation is that the education banner should appear on the first few posts, with the number controlled by the educate_until_posts site setting. By default, that value is 2.

For testing, I changed it to 5 just to be extra safe. However, my test user only saw the education message once.

I also looked at the code:

As I understand it, the method first rules out personal messages and users who already have a record indicating that the education message has been shown. That part makes sense to me.

Then it determines whether the user is creating a topic or a reply and calculates the user’s total number of posts/topics.

The next part is what confuses me. If the total post count is lower than the configured limit, we create the record that prevents the education message from being shown again - and then display the message.

What am I missing here?

For example, if educate_until_posts is left at its default value of 2, I would expect the message to be shown for the user’s first two posts.

The user starts creating their very first post. It’s not a PM, and there is no existing UserHistory record yet, so the message is shown - that makes sense.

But why is the UserHistory record created immediately afterward? Wouldn’t that prevent the message from ever being shown again?

I would have expected something more like this:

  count = @user.topic_count + @user.post_count


  if count >= SiteSetting.educate_until_posts
    UserHistory.create!(
      action: UserHistory.actions[:notified_about_composer_education],
      target_user_id: @user.id,
    )
  elsif count < SiteSetting.educate_until_posts
      return (

But if this were actually a problem, I assume the tests related to that setting would have failed. Since the PR was merged, they apparently did not.

Can someone help me understand what I’m overlooking here?

Wow what a little rabbit hole. I think the confusion rightly stems from the missing update to the setting name (educate_until_posts), because, afaik, in PR#400074 it seems to intend that the notice is only shown once, and never again, regardless of any count.

So now the setting no longer means “show the message for the first N posts”, but instead

“Only ever show the education message if the user’s post count is already below this threshold, and even then, show it exactly once.”

@Roman Am I correct to think we should update the copy of this setting?

The main motivation behind this change was to stop the education message from showing up over and over again. But now that I’ve seen this topic, I think I may have gone a bit too far, since it kind of makes the setting irrelevant if the message only shows once.

I’ll take another look and see if I can find a better middle ground. Will update here once I do.