mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
DEV: Don't publish post messages to non-human users.
This commit is contained in:
parent
a88f931d6f
commit
dcf9c6da59
|
@ -175,13 +175,15 @@ class Post < ActiveRecord::Base
|
|||
|
||||
if Topic.visible_post_types.include?(post_type)
|
||||
if topic.private_message?
|
||||
opts[:user_ids] = User.where("admin OR moderator").pluck(:id)
|
||||
opts[:user_ids] = User.human_users.where("admin OR moderator").pluck(:id)
|
||||
opts[:user_ids] |= topic.allowed_users.pluck(:id)
|
||||
else
|
||||
opts[:group_ids] = topic.secure_group_ids
|
||||
end
|
||||
else
|
||||
opts[:user_ids] = User.where("admin OR moderator OR id = ?", user_id).pluck(:id)
|
||||
opts[:user_ids] = User.human_users
|
||||
.where("admin OR moderator OR id = ?", user_id)
|
||||
.pluck(:id)
|
||||
end
|
||||
|
||||
MessageBus.publish(channel, message, opts)
|
||||
|
|
|
@ -53,7 +53,7 @@ describe ::DiscoursePoll::PollsController do
|
|||
expect(json["vote"]).to eq(["5c24fc1df56d764b550ceae1b9319125"])
|
||||
|
||||
expect(message.channel).to eq("/polls/#{poll.topic_id}")
|
||||
expect(message.user_ids).to contain_exactly(-2, -1, user.id, user2.id)
|
||||
expect(message.user_ids).to contain_exactly(user.id, user2.id)
|
||||
expect(message.group_ids).to eq(nil)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user