feat: Add private note action to automations (#11926)
## Summary - allow AutomationRule to accept `add_private_note` action - support `add_private_note` in automation action service - expose private note action in frontend constants and i18n - test new automation rule action ## Testing - `pnpm eslint app/javascript/dashboard/routes/dashboard/settings/automation/constants.js` - `bundle exec rubocop app/services/automation_rules/action_service.rb app/models/automation_rule.rb spec/services/automation_rules/action_service_spec.rb` - `bundle exec rspec spec/services/automation_rules/action_service_spec.rb` ------ https://chatgpt.com/codex/tasks/task_e_6870c5f7b8b88326a9bd60b2ba710ccd Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
@@ -117,5 +117,27 @@ RSpec.describe AutomationRules::ActionService do
|
||||
expect(mailer).to have_received(:conversation_transcript).exactly(1).times
|
||||
end
|
||||
end
|
||||
|
||||
describe '#perform with add_private_note action' do
|
||||
let(:message_builder) { double }
|
||||
|
||||
before do
|
||||
allow(Messages::MessageBuilder).to receive(:new).and_return(message_builder)
|
||||
rule.actions.delete_if { |a| a['action_name'] == 'send_message' }
|
||||
rule.actions << { action_name: 'add_private_note', action_params: ['Note'] }
|
||||
end
|
||||
|
||||
it 'will add private note' do
|
||||
expect(message_builder).to receive(:perform)
|
||||
described_class.new(rule, account, conversation).perform
|
||||
end
|
||||
|
||||
it 'will not add note if conversation is a tweet' do
|
||||
twitter_inbox = create(:inbox, channel: create(:channel_twitter_profile, account: account))
|
||||
conversation = create(:conversation, inbox: twitter_inbox, additional_attributes: { type: 'tweet' })
|
||||
expect(message_builder).not_to receive(:perform)
|
||||
described_class.new(rule, account, conversation).perform
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user