`educate_until_posts`가 `check_education_message`의 최근 변경 사항과 어떻게 상호작용하나요?

“Thanks for Contributing” Popup in Posts Appearing Even After Limit Passed?에서 이어서 논의합니다:

이 변경 사항에 대해 질문이 있습니다. 테스트할 때 어떻게 작동해야 하는지 놓치고 있거나 오해하고 있는 것 같습니다.

제 기대치는 educate_until_posts 사이트 설정 값으로 제어되는 초기 몇 개의 게시물에 교육 배너가 표시되어야 한다는 것입니다. 기본값은 2입니다.

테스트를 위해 더 안전을 기하기 위해 이 값을 5로 변경했습니다. 그러나 제 테스트 사용자는 교육 메시지를 단 한 번만 확인했습니다.

또한 코드를 확인해 보았습니다:

제 이해로는, 이 메서드는 먼저 개인 메시지와 교육 메시지가 이미 표시되었음을 나타내는 기록이 이미 있는 사용자를 제외합니다. 이 부분은 이해가 됩니다.

이어서 사용자가 주제를 생성하는지 답글을 작성하는지를 판별하고 사용자의 총 게시물/주제 수를 계산합니다.

혼란스러운 부분은 다음 부분입니다. 총 게시물 수가 설정된 한도보다 낮으면, 교육 메시지가 다시 표시되지 않도록 방지하는 기록을 생성한 후 메시지를 표시합니다.

여기서 제가 놓치고 있는 것이 무엇일까요?

예를 들어, educate_until_posts가 기본값인 2로 남아 있는 경우, 사용자의 첫 두 게시물에 메시지가 표시될 것이라고 기대했습니다.

사용자가 첫 번째 게시물을 작성하기 시작합니다. 개인 메시지가 아니고, 기존 UserHistory 기록도 없으므로 메시지가 표시됩니다 - 이는 이해가 됩니다.

그런데 왜 바로 그 직후 UserHistory 기록이 생성되나요? 그러면 메시지가 다시는 표시되지 않게 되지 않나요?

더 유사한 구조를 기대했습니다:

  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 (

하지만 이것이 실제로 문제라면, 해당 설정과 관련된 테스트가 실패했을 것이라고 생각합니다. PR이 병합되었으므로, 테스트는 실패하지 않은 것으로 보입니다.

여기서 제가 놓치고 있는 부분을 이해하는 데 도움을 주실 수 있을까요?

5개의 좋아요

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?

2개의 좋아요

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.

4개의 좋아요

어제 이 수정 사항을 병합했습니다:

educate_until_posts 임계값 이하에 있는 경우, 교육용 메시지는 입력을 시작할 때 한 번만 표시되며, 게시물을 작성하거나 페이지를 새로고침하지 않는 한 다시 표시되지 않습니다.

2개의 좋아요