Suppress user pings in imported posts

We are importing a bunch of posts, and the content often contains text like @global or similar (the topic of our discourse instance is related to programming, and @ is a symbol in that language).

Is there a nice and clean way to suppress pinging users? I don’t mind pre-processing the posts before importing.

As a kinda dirty workaround, I found that inserting an empty bbcode tag after the @ works (like @[b][/b]global). It just doesn’t feel like a very good solution and would require me to parse/tokenize the markdown, since the bbcode should not be inserted if the string is within a code block. So it is not a good solution. A zero-width space is also not a solution as that will lead to weird errors when users copy the code snippet into their own source code.

If it’s in a code block it’s not a problem. If your can make sure it’s always in a code block, you’re in good shape. You’ve got to run a real parser to know when you’re in a code block, though.

Oh, or turn off the Allow users to mention other users setting while you import the data.

1 Like

Sure if the @name is in a codeblock then it’s not a problem. The problem is detecting when it is and when it isn’t, so that I can prevent the ping outside of codeblocks by inserting the invisible [b][/b] tag between @ and the name. It would indeed require a full markdown parser/tokenizer.

Hmm, does that still apply even when the post is later rebaked or would that lead to random pings in that event?

I’m pretty sure that when they are rebaked it’s Wyeth a switch to avoid bumps and mentions, but I’ve nether checked the code nor tried it.

I don’t see anything preventing pings, the changes are directly published to clients as far as I understand it (but I am by far no expert in ruby or with discourse, so please correct me if I’m wrong):

I think this

I think bypass bump also stops mentors from happening again, but and trigger post process has

`new_post: false,`

So I think you’re safe.

2 Likes

Ohhh good spot, I missed that part! Perfect, I will do that then :sparkles:

1 Like

And it may be the case that import scripts set this already. I don’t think a import causes a zillion notifications.

2 Likes

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