Skip to content

fix: hide Edit/Delete buttons from unauthorized users (#238) and respect email opt-out (#241)#248

Open
yihangwu539-png wants to merge 2 commits intoalgora-io:mainfrom
yihangwu539-png:fix/issue-238-241-ui-auth-email-optout
Open

fix: hide Edit/Delete buttons from unauthorized users (#238) and respect email opt-out (#241)#248
yihangwu539-png wants to merge 2 commits intoalgora-io:mainfrom
yihangwu539-png:fix/issue-238-241-ui-auth-email-optout

Conversation

@yihangwu539-png
Copy link
Copy Markdown

This PR fixes two issues:

Issue #238 - [UI Bug] Unauthorized 'Edit' and 'Delete' buttons visible

File changed: lib/algora_web/live/org/bounties_live.ex

The "Edit Amount" and "Delete" buttons were rendered for all users on the org bounties listing page. While the backend correctly rejected unauthorized requests (showing "You are not authorized" toast messages), the buttons should not be visible at all to users who cannot use them.

Fix: Added :if={@current_user_role in [:admin, :mod]} guards to both buttons, matching the authorization check already present in the edit-bounty-amount and delete-bounty event handlers.

Issue #241 - Platform emails users who have opted out

File changed: lib/algora/cloud.ex

The notify_match/1 function was scheduling job match notification emails (via AlgoraCloud.EmailScheduler) without checking if the user had set opt_out_algora to true. This caused users who explicitly opted out of Algora communications to still receive recruitment emails.

Fix: Added a check for the user's opt_out_algora flag before scheduling the email. If the user has opted out, the email is skipped with {:ok, :skipped}.

…io#238)

Add `:if={@current_user_role in [:admin, :mod]}` condition to the
"Edit Amount" and "Delete" buttons in the org bounties listing page.
The backend already rejects unauthorized requests, but the buttons
should not be rendered at all for users who can't use them.
…ls (algora-io#241)

Check the user's `opt_out_algora` flag before scheduling job match
notification emails. Users who have explicitly opted out should not
receive recruitment spam from the platform.
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.

1 participant