Repository navigation
Conversation
With with_templates, ListBroadcasts looked up each variation's template even for a caller without Templates read: every lookup was refused and logged at error level. It now skips them for such a caller, who gets the broadcasts without their templates, as before.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #542 +/- ##
=======================================
Coverage 88.96% 88.97%
=======================================
Files 377 377
Lines 73836 73836
=======================================
+ Hits 65688 65692 +4
+ Misses 5439 5435 -4
Partials 2709 2709
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up of #536. When
broadcasts.listis called withwith_templates,BroadcastService.ListBroadcastslooked up each variation's template. It did so even for a caller without Templates read, such as a console member or an API key. Each of those lookups was refused and logged at error level, on every page load.The service already holds the caller's permissions, so it now skips those lookups for such a caller. The response does not change: the broadcasts come back without their templates, as before, and the console names each template by its ID since #536. The only thing that goes away is the refused calls and their logs.
Why fix this in the service rather than in the console: the console would have had to wait for the members request before listing broadcasts. That adds a serial request for everyone and a new loading state. The service fix also covers API keys.
No migration, no environment variable, no console change. There is no new CHANGELOG line: the 44.0 Fix line of #536 already says these screens no longer request templates such a member cannot read.
Plan and tests
Plan:
plans/fix-broadcasts-list-without-templates-read-plan.md.New cases in
internal/service/broadcast_service_test.go:The two existing
WithTemplatescases now authenticate a member who has Templates read.make test-servicepasses.Known, not handled
broadcasts.getwithwith_templatesdoes the same lookups in the handler. The console never asks it for templates.