Skip to content

Commit 868ecf3

Browse files
committed
Add flash error message for invalid orgs
- Flash message displays when an org is not present in orgs table AND does not pass ROR validation - Add request.present? to message condition in order for controller tests to work properly
1 parent 64326e1 commit 868ecf3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/controllers/contributors_controller.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ def process_org(hash:)
122122
# Check if entered org has a valid ROR
123123
# If so, allow creation
124124
allow = validate_ror(hash)
125+
126+
# If org ROR cannot be validated, then contributor org is invalid
127+
# Only trigger flash during a real request (tests calling this method directly have no request object)
128+
if !allow && request.present?
129+
flash[:alert] =
130+
_('Invalid contributor affiliation. Please double check that your organisation does not appear in the list ' \
131+
'in a slightly different form.')
132+
end
133+
125134
org = org_from_params(params_in: hash,
126135
allow_create: allow)
127136

0 commit comments

Comments
 (0)