FIX: remove @discobot likes feature on public topics (#12522)

https://meta.discourse.org/t/discobot-is-breaking-the-meaning-of-likes-on-my-community/183804/8?u=techapj
This commit is contained in:
Arpit Jalan 2021-03-25 18:23:55 +05:30 committed by GitHub
parent acc73f2989
commit edcb5f77da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -61,7 +61,7 @@ module DiscourseNarrativeBot
klass.new.input(@input, @user, post: @post, skip: skip_track?)
end
elsif is_reply && (@is_pm_to_bot || public_reply?)
like_user_post
like_user_post if @is_pm_to_bot
bot_commands
end
elsif data && data.dig(:state)&.to_sym != :end && is_topic_action?

View File

@ -475,6 +475,16 @@ describe DiscourseNarrativeBot::TrackSelector do
expect(new_post.raw).to eq(random_mention_reply)
end
it 'should not like the public post' do
post.update!(raw: 'thanks @discobot!')
expect { described_class.new(:reply, user, post_id: post.id).select }
.to change { PostAction.count }.by(0)
new_post = Post.last
expect(new_post.raw).to eq(random_mention_reply)
end
describe 'rate limiting random reply message in public topic' do
let(:topic) { Fabricate(:topic) }
let(:other_post) { Fabricate(:post, raw: '@discobot show me something', topic: topic) }