Initial commit: Add logistics and order_detail message types
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
28
spec/enterprise/policies/article_policy_spec.rb
Normal file
28
spec/enterprise/policies/article_policy_spec.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Enterprise::ArticlePolicy', type: :policy do
|
||||
subject(:article_policy) { ArticlePolicy }
|
||||
|
||||
let(:account) { create(:account) }
|
||||
let(:agent) { create(:user, account: account) } # Needed for author
|
||||
let(:portal) { create(:portal, account: account) }
|
||||
let(:article) { create(:article, account: account, portal: portal, author: agent) }
|
||||
|
||||
# Create a custom role with knowledge_base_manage permission
|
||||
let(:custom_role) { create(:custom_role, account: account, permissions: ['knowledge_base_manage']) }
|
||||
let(:agent_with_role) { create(:user) } # Create without account
|
||||
let(:agent_with_role_account_user) do
|
||||
create(:account_user, user: agent_with_role, account: account, role: :agent, custom_role: custom_role)
|
||||
end
|
||||
let(:agent_with_role_context) do
|
||||
{ user: agent_with_role, account: account, account_user: agent_with_role_account_user }
|
||||
end
|
||||
|
||||
permissions :index?, :update?, :show?, :edit?, :create?, :destroy?, :reorder? do
|
||||
context 'when agent with knowledge_base_manage permission' do
|
||||
it { expect(article_policy).to permit(agent_with_role_context, article) }
|
||||
end
|
||||
end
|
||||
end
|
||||
27
spec/enterprise/policies/category_policy_spec.rb
Normal file
27
spec/enterprise/policies/category_policy_spec.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Enterprise::CategoryPolicy', type: :policy do
|
||||
subject(:category_policy) { CategoryPolicy }
|
||||
|
||||
let(:account) { create(:account) }
|
||||
let(:portal) { create(:portal, account: account) }
|
||||
let(:category) { create(:category, account: account, portal: portal, slug: 'test-category') }
|
||||
|
||||
# Create a custom role with knowledge_base_manage permission
|
||||
let(:custom_role) { create(:custom_role, account: account, permissions: ['knowledge_base_manage']) }
|
||||
let(:agent_with_role) { create(:user) } # Create without account
|
||||
let(:agent_with_role_account_user) do
|
||||
create(:account_user, user: agent_with_role, account: account, role: :agent, custom_role: custom_role)
|
||||
end
|
||||
let(:agent_with_role_context) do
|
||||
{ user: agent_with_role, account: account, account_user: agent_with_role_account_user }
|
||||
end
|
||||
|
||||
permissions :index?, :update?, :show?, :edit?, :create?, :destroy? do
|
||||
context 'when agent with knowledge_base_manage permission' do
|
||||
it { expect(category_policy).to permit(agent_with_role_context, category) }
|
||||
end
|
||||
end
|
||||
end
|
||||
33
spec/enterprise/policies/company_policy_spec.rb
Normal file
33
spec/enterprise/policies/company_policy_spec.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CompanyPolicy, type: :policy do
|
||||
subject(:company_policy) { described_class }
|
||||
|
||||
let(:account) { create(:account) }
|
||||
let(:administrator) { create(:user, :administrator, account: account) }
|
||||
let(:agent) { create(:user, account: account) }
|
||||
let(:company) { create(:company, account: account) }
|
||||
|
||||
let(:administrator_context) { { user: administrator, account: account, account_user: account.account_users.first } }
|
||||
let(:agent_context) { { user: agent, account: account, account_user: account.account_users.first } }
|
||||
|
||||
permissions :index?, :show?, :create?, :update? do
|
||||
context 'when administrator' do
|
||||
it { expect(company_policy).to permit(administrator_context, company) }
|
||||
end
|
||||
|
||||
context 'when agent' do
|
||||
it { expect(company_policy).to permit(agent_context, company) }
|
||||
end
|
||||
end
|
||||
|
||||
permissions :destroy? do
|
||||
context 'when administrator' do
|
||||
it { expect(company_policy).to permit(administrator_context, company) }
|
||||
end
|
||||
|
||||
context 'when agent' do
|
||||
it { expect(company_policy).not_to permit(agent_context, company) }
|
||||
end
|
||||
end
|
||||
end
|
||||
65
spec/enterprise/policies/conversation_policy_spec.rb
Normal file
65
spec/enterprise/policies/conversation_policy_spec.rb
Normal file
@@ -0,0 +1,65 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ConversationPolicy, type: :policy do
|
||||
subject { described_class }
|
||||
|
||||
let(:account) { create(:account) }
|
||||
let(:agent) { create(:user, account: account, role: :agent) }
|
||||
let(:inbox) { create(:inbox, account: account) }
|
||||
let(:agent_account_user) { agent.account_users.find_by(account: account) }
|
||||
let(:context) { { user: agent, account: account, account_user: agent_account_user } }
|
||||
|
||||
before do
|
||||
create(:inbox_member, user: agent, inbox: inbox)
|
||||
end
|
||||
|
||||
permissions :show? do
|
||||
context 'when role grants conversation_unassigned_manage' do
|
||||
let(:custom_role) { create(:custom_role, account: account, permissions: ['conversation_unassigned_manage']) }
|
||||
|
||||
before do
|
||||
agent_account_user.update!(role: :agent, custom_role: custom_role)
|
||||
end
|
||||
|
||||
it 'allows access to conversations assigned to the agent' do
|
||||
conversation = create(:conversation, account: account, inbox: inbox, assignee: agent)
|
||||
|
||||
expect(subject).to permit(context, conversation)
|
||||
end
|
||||
|
||||
it 'denies access to conversations assigned to someone else' do
|
||||
other_agent = create(:user, account: account, role: :agent)
|
||||
conversation = create(:conversation, account: account, inbox: inbox, assignee: other_agent)
|
||||
|
||||
expect(subject).not_to permit(context, conversation)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when role grants conversation_participating_manage' do
|
||||
let(:custom_role) { create(:custom_role, account: account, permissions: ['conversation_participating_manage']) }
|
||||
|
||||
before do
|
||||
agent_account_user.update!(role: :agent, custom_role: custom_role)
|
||||
end
|
||||
|
||||
it 'allows access to conversations assigned to the agent' do
|
||||
conversation = create(:conversation, account: account, inbox: inbox, assignee: agent)
|
||||
|
||||
expect(subject).to permit(context, conversation)
|
||||
end
|
||||
|
||||
it 'allows access to conversations where the agent is a participant' do
|
||||
conversation = create(:conversation, account: account, inbox: inbox, assignee: nil)
|
||||
create(:conversation_participant, conversation: conversation, account: account, user: agent)
|
||||
|
||||
expect(subject).to permit(context, conversation)
|
||||
end
|
||||
|
||||
it 'denies access to unrelated conversations' do
|
||||
conversation = create(:conversation, account: account, inbox: inbox, assignee: nil)
|
||||
|
||||
expect(subject).not_to permit(context, conversation)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
26
spec/enterprise/policies/csat_survey_response_policy_spec.rb
Normal file
26
spec/enterprise/policies/csat_survey_response_policy_spec.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Enterprise::CsatSurveyResponsePolicy', type: :policy do
|
||||
subject(:csat_policy) { CsatSurveyResponsePolicy }
|
||||
|
||||
let(:account) { create(:account) }
|
||||
let(:csat_survey_response) { create(:csat_survey_response, account: account) }
|
||||
|
||||
# Create a custom role with report_manage permission
|
||||
let(:custom_role) { create(:custom_role, account: account, permissions: ['report_manage']) }
|
||||
let(:agent_with_role) { create(:user) } # Create without account
|
||||
let(:agent_with_role_account_user) do
|
||||
create(:account_user, user: agent_with_role, account: account, role: :agent, custom_role: custom_role)
|
||||
end
|
||||
let(:agent_with_role_context) do
|
||||
{ user: agent_with_role, account: account, account_user: agent_with_role_account_user }
|
||||
end
|
||||
|
||||
permissions :index?, :metrics?, :download? do
|
||||
context 'when agent with report_manage permission' do
|
||||
it { expect(csat_policy).to permit(agent_with_role_context, csat_survey_response) }
|
||||
end
|
||||
end
|
||||
end
|
||||
32
spec/enterprise/policies/portal_policy_spec.rb
Normal file
32
spec/enterprise/policies/portal_policy_spec.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Enterprise::PortalPolicy', type: :policy do
|
||||
subject(:portal_policy) { PortalPolicy }
|
||||
|
||||
let(:account) { create(:account) }
|
||||
let(:portal) { create(:portal, account: account) }
|
||||
|
||||
# Create a custom role with knowledge_base_manage permission
|
||||
let(:custom_role) { create(:custom_role, account: account, permissions: ['knowledge_base_manage']) }
|
||||
let(:agent_with_role) { create(:user) } # Create without account
|
||||
let(:agent_with_role_account_user) do
|
||||
create(:account_user, user: agent_with_role, account: account, role: :agent, custom_role: custom_role)
|
||||
end
|
||||
let(:agent_with_role_context) do
|
||||
{ user: agent_with_role, account: account, account_user: agent_with_role_account_user }
|
||||
end
|
||||
|
||||
permissions :update?, :edit?, :logo? do
|
||||
context 'when agent with knowledge_base_manage permission' do
|
||||
it { expect(portal_policy).to permit(agent_with_role_context, portal) }
|
||||
end
|
||||
end
|
||||
|
||||
permissions :create?, :destroy? do
|
||||
context 'when agent with knowledge_base_manage permission' do
|
||||
it { expect(portal_policy).not_to permit(agent_with_role_context, portal) }
|
||||
end
|
||||
end
|
||||
end
|
||||
26
spec/enterprise/policies/report_policy_spec.rb
Normal file
26
spec/enterprise/policies/report_policy_spec.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Enterprise::ReportPolicy', type: :policy do
|
||||
subject(:report_policy) { ReportPolicy }
|
||||
|
||||
let(:account) { create(:account) }
|
||||
let(:report) { :report }
|
||||
|
||||
# Create a custom role with report_manage permission
|
||||
let(:custom_role) { create(:custom_role, account: account, permissions: ['report_manage']) }
|
||||
let(:agent_with_role) { create(:user) } # Create without account
|
||||
let(:agent_with_role_account_user) do
|
||||
create(:account_user, user: agent_with_role, account: account, role: :agent, custom_role: custom_role)
|
||||
end
|
||||
let(:agent_with_role_context) do
|
||||
{ user: agent_with_role, account: account, account_user: agent_with_role_account_user }
|
||||
end
|
||||
|
||||
permissions :view? do
|
||||
context 'when agent with report_manage permission' do
|
||||
it { expect(report_policy).to permit(agent_with_role_context, report) }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user