如何为分阶段用户禁用邮件?

Continuing the discussion from Description of various user states in Discourse (Admin / Moderator / Staff / Developer / Other ):

I’ve got a forum that includes a Google Groups import. For Reasons, the intention is that this will be a static archive of the Google Group. The Google Group will continue to function standalone and the forum will simply include its posts as static archived data. Right now, I’m doing that by periodically running the Google Import script, but think that I’ll soon instead configure incoming mail and subscribe the category to the Google Group list.

I have turned off enabled staged users. The users all show as active=false and staged=true.

If someone replies to a post, they get an email.

If someone PMs them, they get an email.

If I change the user’s staged status to false, they no longer get PMs, but they do still get notifications about replies to their messages. This seems like a fine behavior, and exactly what someone else was asking about just today, but this entity believes that they do not have permission to email these Google Groups users who have not created an account on the forum.

Maybe I can modify the import script and/or make a plugin that will do something like make all active=false users automatically set to staged=false? Maybe I set the archive category so that it cannot be watched (in a plugin, I guess)?

For the record, here’s how staged users are supposed to be treated:

2 个赞

Continuing the discussion from How to disable mail for staged users?:

Well, I didn’t figure out a way to keep staged users from getting email, so I guess I’ll do

def no_mail_for_staged_users
  staged=User.where(staged: true)
  staged.all.each do |user|
    o=UserOption.find_by(user_id: user.id)
    o.email_level = 2
    o.email_messages_level = 2
    o.email_digests = false
    o.save
  end
end

and modify the mbox script to similarly disable email for the staged users that it creates.

If anyone has any better ideas, I’d be interested to hear.

Are you on latest? There was a bug around staged users getting email that we fixed in the last week or two.

2 个赞

That would be good. I’ll check on Monday and see about undoing the user option changes.

1 个赞

有这个插件吗?

这是一个非常老的话题,我写这个的时候正在做的事情现在已经不可能了。

看起来我将那个函数添加到了导入用户的脚本中。如果你因为某些原因想让它发生,那么你可能需要一个插件来实现。描述一下是什么导致了你不想收到邮件的已暂存用户;你可能需要更新任何正在做这件事的东西,来运行一个像我包含的那个脚本。如果你需要一个自定义插件来做这件事,你可以在 Marketplace 发帖或直接联系我。

1 个赞