Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Validation for purchased pricing_plan_quantity (#8809)
- Add validations based on purchased pricing_plan_quantity - Modify the Dashboard to support the new error message
- Loading branch information
1 parent
eeb0113
commit 0805f36
Showing
4 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,3 +161,4 @@ def remove_macros | |
end | ||
|
||
User.include_mod_with('Audit::User') | ||
User.include_mod_with('Concerns::User') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Enterprise::Concerns::User | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
before_validation :ensure_installation_pricing_plan_quantity | ||
end | ||
|
||
def ensure_installation_pricing_plan_quantity | ||
return unless ChatwootHub.pricing_plan == 'premium' | ||
|
||
errors.add(:base, 'User limit reached. Please purchase more licenses from super admin') if User.count >= ChatwootHub.pricing_plan_quantity | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters