mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
Don't reject likes by email for closed topics (#4311)
This commit is contained in:
parent
5c1e18ecc8
commit
3588780ac3
2 changed files with 6 additions and 1 deletions
|
@ -404,11 +404,11 @@ module Email
|
||||||
|
|
||||||
def create_reply(options={})
|
def create_reply(options={})
|
||||||
raise TopicNotFoundError if options[:topic].nil? || options[:topic].trashed?
|
raise TopicNotFoundError if options[:topic].nil? || options[:topic].trashed?
|
||||||
raise TopicClosedError if options[:topic].closed?
|
|
||||||
|
|
||||||
if post_action_type = post_action_for(options[:raw])
|
if post_action_type = post_action_for(options[:raw])
|
||||||
create_post_action(options[:user], options[:post], post_action_type)
|
create_post_action(options[:user], options[:post], post_action_type)
|
||||||
else
|
else
|
||||||
|
raise TopicClosedError if options[:topic].closed?
|
||||||
options[:topic_id] = options[:post].try(:topic_id)
|
options[:topic_id] = options[:post].try(:topic_id)
|
||||||
options[:reply_to_post_number] = options[:post].try(:post_number)
|
options[:reply_to_post_number] = options[:post].try(:post_number)
|
||||||
options[:is_group_message] = options[:topic].private_message? && options[:topic].allowed_groups.exists?
|
options[:is_group_message] = options[:topic].private_message? && options[:topic].allowed_groups.exists?
|
||||||
|
|
|
@ -129,6 +129,11 @@ describe Email::Receiver do
|
||||||
expect { process(:reply_user_matching) }.to raise_error(Email::Receiver::TopicClosedError)
|
expect { process(:reply_user_matching) }.to raise_error(Email::Receiver::TopicClosedError)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not raise TopicClosedError when performing a like action" do
|
||||||
|
topic.update_columns(closed: true)
|
||||||
|
expect { process(:like) }.to change(PostAction, :count)
|
||||||
|
end
|
||||||
|
|
||||||
it "raises an InvalidPost when there was an error while creating the post" do
|
it "raises an InvalidPost when there was an error while creating the post" do
|
||||||
expect { process(:too_small) }.to raise_error(Email::Receiver::InvalidPost)
|
expect { process(:too_small) }.to raise_error(Email::Receiver::InvalidPost)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue