Skip to content

Conversation

@regdocs
Copy link
Member

@regdocs regdocs commented Nov 10, 2025

This is a workaround to prevent the cluster scoped banners' dismissal permission issue where the dismissal was failing for unprivileged Press Admin users but succeeding for System Managers. Need to investigate this further.

@regdocs regdocs requested a review from BreadGenie November 10, 2025 14:18
@regdocs regdocs self-assigned this Nov 10, 2025
This was intentional because there was a 403 Permission Error being thrown which prevented the user from dismissing the Cluster scoped banners while dismissals for other scopes seemed to be working. Not sure why. No doctype level role permission updates or has_permission overrides seemed to help in any way. Will investigate this further but pushing this workaround for now.
Comment on lines 1480 to 1495
@frappe.whitelist()
def dismiss_banner(banner_name):
user = frappe.session.user
banner = frappe.get_doc("Dashboard Banner", banner_name)
if banner and banner.is_dismissible and not banner.is_global:
banner.append(
"user_dismissals",
{
"user": user,
"dismissed_at": frappe.utils.now(),
"parent": banner_name,
},
)
banner.save()
banner.save(ignore_permissions=True)
return True
return False
Copy link
Member

@ssiyad ssiyad Nov 10, 2025

Choose a reason for hiding this comment

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

I think this entire block should be inside the banner controller.

ignore_permissions is a bad way to fix things. Most probably the issue is with permissions on a specific banner, which can be fixed with has_permission hook.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree. I had tried the controller thing initially but was hitting a permission road block. Will attempt it again and let you know how that goes.

@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 45.01%. Comparing base (3647dcd) to head (e90ec57).
⚠️ Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
press/api/account.py 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3843      +/-   ##
===========================================
- Coverage    45.02%   45.01%   -0.02%     
===========================================
  Files          714      714              
  Lines        48570    48570              
===========================================
- Hits         21868    21863       -5     
- Misses       26702    26707       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants