'watching first post' on a tag doesn't work on existing topic?

I could swear this worked in my early testing, as it’s key to my workflow: I could tag an existing post, and users with watching_first_post on that tag would get a notification.

I’ve now found it does not work this way (…anymore…?)

Or maybe it’s being ignored when there are already reply posts under that topic?

I imagine I could move topics to a category where everyone is ‘watching first post’, but…

  1. Are notifications only triggered at topic creation?
  2. I’m not sure if the presence of reply posts would cause the ‘first post’ trigger to be ignored.
  3. I really wanted to keep related topics in one category, and “escalate” some via tag.

I’m willing to run a script to kick off notifications each time, but the Askbot :robot: couldn’t help me create one that works.

I’d welcome any input or workarounds…!

image

But how would this work? What if there are 10,000 old topics with the tag, do you get notified right away?

Watch first post only notifies on the absolute first post in the topic.

1 Like

That’s pretty definitive, so I must be mis-remembering, and had created test topics with the tracked tag present.

Oh no – I’m not suggesting that setting a user to ‘watch first post’ via tag should do anything retroactive.

But surely it’s common for posted topics to be tagged by staff later. I’d just somehow imagined that when a ‘watch first post’ tag is applied to an existing topic, it would generate a notification of that topic for users already WFP-ing the tag.

I’m still working with Askbot to come up with an ad-hoc script for these occasions…

After about 60 iterations, Askbot and I have a rails script almost working.

The script below – for topic 239 and tag ‘tagtest’ – generates the expected “New Topic” notifications with the correct topic title, and generates related emails.

Some elements seem inert (message: and display_username: don’t appear in any output) but it nearly works.

The showstopper is the emails don’t arrive with the actual topic title in the header. It comes through as " %{topic_title} ". topic_title is apparently not a valid field for the Notification method, so I’m not sure what’s the minimum code neccessary to get it into the email. (Askbot tried adding ever-more elaborate email methods, with ever-increasing errors.)

If someone could help with that detail, it would keep me afloat until I learn how to clean this up properly…!


topic_id = 239

Tag.where(name: 'tagtest').each do |tag|
  TagUser.where(tag_id: tag.id, notification_level: TagUser.notification_levels[:watching_first_post]).each do |tag_user|
    user = User.find(tag_user.user_id)
    puts "Username: #{user.username}, ID: #{user.id}"

    # Fetch the topic title
    topic = Topic.find(topic_id)
    topic_title = topic.title

    # Create a notification for the topic
    Notification.create!(
      user_id: user.id,
      notification_type: Notification.types[:watching_first_post],
      topic_id: topic_id,
      post_number: 1, # Assuming you want to notify about the first post of the topic
      data: {
        message: 'You have a new notification for a topic you are watching.',
        display_username: 'system'
      }.to_json
    )

  end
end

At the point of tagging also carries risk, for example bulk tagging of 500 topics, then there are 500 notifications, goodbye your notifications.

Or even worse, 100 tags by an admin 10 seconds apart.

It is a tricky problem, we would have to very carefully roll up notifications to amend the feature like this.

Isn’t that the same if you bulk move topics to another category? Moving topics to another category triggers watching first post notifications.

Yeah, I just think generally recategorizing is far rarer that re-tagging so the scale of the problem is somewhat mitigated. Any chance you can do a quick screenshot of what happens when you bulk re-categorize 3 topics to a watch-first?

I wouldn’t dream of bulk tagging 500 topics, but curious, would it cause more strain than posting to an Announcements category that everyone Watches?
(Edit: Oops, Moin posted while I was composing.)

My own use case is maybe one post a week to “escalate” via notification emails.

It feels similar to earlier discussion about recategorized topics:
(Edit: which you already know, sorry.)

…which was addressed by FIX: Missing notification for watching first post users when topic is recategorized · discourse/discourse@147ea37 · GitHub

I’m just aiming to use a tag rather than having two categories for similar topics. (They belong together, but a few are, after posting, deemed worthy of sending out to our quiet, sometimes email-only users.)

1 Like

Just for curiosity/comparison sake, I’m testing the ‘watching first post in category behavior, and it’s not notifying upon recategorization.

My email time window mins is 10, & I’m leaving 15min between steps.
I’ve repeated this several times now…

  • Create new topic in un-watched sandbox category. Wait 15 min.
  • Move the topic into a category a user is Watching: triggers immediate notifications, sends email 10 min later.

  • Create another new topic in un-watched sandbox category. Wait 15 min.
  • Move the topic into a category where a user is ‘Watching First Post’: does nothing, ever.

(Self-hosted std. install, 3.4.0.beta2-dev (0c019b2e45), tests-passed.)

Maybe it’s something about my process, but I can’t imagine what. Is it possible the functionality that got sorted in 2018 has become unsorted?

1 Like

Its very possible, this is a particularly complex area of the app.

Notification on re-tagging / re-categorization needs a lot of guardrails.

  • Should we notify on a 8 year old topic?
  • Should we push 50 notifications at once? In the period of 1 hour?

We need to start from finding out what the desired behavior is and what the guardrails should be.

FWIW Adding a tag to an existing topic should send a notification to anyone Watching First Post for that tag.

I’ve just tested it on my test site (3108e3a6b6) and it still seems to be working correctly.

Just to check, did you change the disable tags edit notifications admin setting at any point? (And disable category edit notifications for the category version).

4 Likes

O.

M.

G.

I’m going to go crawl under a rock.

I had forgotten those settings existed. I imagine when I disabled them I was thinking only of notifications like “an admin has added a tag or changed the category of your topic” – not actions like Watching or WFP notifications.

I think there may still be some inconsistencies, as Watching a category seemed to override disable category edit modifications, while WFP did not. As penance, I will test this more thoroughly and follow up with a couple of other people I pinged on the subject.

(Also, @sam did kind of back up my conclusion :sweat_smile:)

But thank you @JammyDodger for rescuing me from more hours of puttering with rails scripts. My next step was to sell my couch & pay @pfaffman to help.

6 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.