Skip to content

32678 - GOVM account can't receive email if no admin email set - fix#3682

Open
Jxio wants to merge 2 commits intobcgov:mainfrom
Jxio:32678
Open

32678 - GOVM account can't receive email if no admin email set - fix#3682
Jxio wants to merge 2 commits intobcgov:mainfrom
Jxio:32678

Conversation

@Jxio
Copy link
Collaborator

@Jxio Jxio commented Mar 4, 2026

Issue #:
bcgov/entity#32678

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the sbc-auth license (Apache 2.0).

@Jxio Jxio self-assigned this Mar 4, 2026
@Jxio Jxio requested review from ochiu and seeker25 as code owners March 4, 2026 17:16
Comment on lines +1011 to +1014
if client.email:
email_list = ",".join(
{*(email_list.split(",") if email_list else []), client.email.strip()}
)
Copy link
Collaborator

@seeker25 seeker25 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be moved to a function? I'm sure we use something like it somewhere else?
It's also not clear what this does I think it's converting to list, add new email and removing duplicates while stripping whitespaces?
Why not just use a function name for it?
eg. add_unique_email

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it removed

origin_url = current_app.config.get("WEB_APP_URL")
if admin_emails != "":
client: UserModel = UserModel.find_by_id(client_id)
client_login_source = client.login_source
Copy link
Collaborator

@seeker25 seeker25 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just use
client.login_source
I don't really see you doing anything with client_login_source other than just passing it in

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code revert

email_list = UserService.get_admin_emails_for_org(org_id)
origin_url = current_app.config.get("WEB_APP_URL")
if admin_emails != "":
client: UserModel = UserModel.find_by_id(client_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client = UserModel.find_by_id(client_id)
you don't need the type it should be inferred

if email_list != "":
if org.access_type in (AccessType.EXTRA_PROVINCIAL.value, AccessType.REGULAR_BCEID.value):
Org.send_approved_rejected_notification(admin_emails, org.name, org.id, org.status_code, client_id)
Org.send_approved_rejected_notification(email_list, org.name, org.id, org.status_code, client_login_source)
Copy link
Collaborator

@seeker25 seeker25 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user.email Probably doesn't work for these? user.email was only intended for GOVM - BCEID I think should still come from contacts?

Sent you proof in teams

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated: if org is GOVM, use user.email

elif org.access_type in (AccessType.GOVM.value, AccessType.GOVN.value):
Org.send_approved_rejected_govm_govn_notification(
admin_emails, org.name, org.id, org.status_code, origin_url, client_id
email_list, org.name, org.id, org.status_code, origin_url, client_login_source
Copy link
Collaborator

@seeker25 seeker25 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOVN using user.email? it could be wrong? GOVN could be BCSC which would be contact.email

Sent you proof in teams

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants