Create valuation comments creation ability
Why: Only admins or valuators (for those investments they've assigned) can create internal valuation comments on them. How: * Creating a new `comment_valuation` ability for admins and valuators in the same manner the `valuate` ability works. * Adding a validation at Comment model for those with `valuation` flag active that checks if the author can make a valuation comment on the commentable, as well as the respective active record error messages. This will prevent comments from being created at a controller level as well. * Improving comment factory trait `valuation` to have an associated investment, author that is a valuator and setting the valuator on the valuators list of the investment
This commit is contained in:
@@ -296,6 +296,10 @@ en:
|
||||
image:
|
||||
image_width: "Width must be %{required_width}px"
|
||||
image_height: "Height must be %{required_height}px"
|
||||
comment:
|
||||
attributes:
|
||||
valuation:
|
||||
cannot_comment_valuation: 'You cannot comment a valuation'
|
||||
messages:
|
||||
record_invalid: "Validation failed: %{errors}"
|
||||
restrict_dependent_destroy:
|
||||
|
||||
@@ -292,6 +292,10 @@ es:
|
||||
image:
|
||||
image_width: "Debe tener %{required_width}px de ancho"
|
||||
image_height: "Debe tener %{required_height}px de alto"
|
||||
comment:
|
||||
attributes:
|
||||
valuation:
|
||||
cannot_comment_valuation: 'No puedes comentar una evaluación'
|
||||
messages:
|
||||
record_invalid: 'Error de validación: %{errors}'
|
||||
restrict_dependent_destroy:
|
||||
|
||||
Reference in New Issue
Block a user