discourse/spec
Martin Brennan 38742bc208
FIX: Wrong scope used for notification levels user serializer (#13039)
This is a recent regression introduced by https://github.com/discourse/discourse/pull/12937 which makes it so that when looking at a user profile that is not your own, specifically the category and tag notification settings, you would see your own settings instead of the target user. This is only a problem for admins because regular users cannot see these details for other users.

The issue was that we were using `scope` in the serializer, which refers to the current user, rather than using a scope for the target user via `Guardian.new(user)`.

However, on further inspection the `notification_levels_for` method for `TagUser` and `CategoryUser` did not actually need to be accepting an instance of Guardian, all that it was using it for was to check guardian.anonymous? which is just a fancy way of saying user.blank?. Changed this method to just accept a user instead and send the user in from the serializer.
2021-05-14 09:45:14 +10:00
..
components DEV: Oneboxer wildcard subdomains (#13015) 2021-05-13 15:48:35 -04:00
fabricators FEATURE: add support for like webhooks (#12917) 2021-04-30 17:08:38 -07:00
fixtures FIX: Catch UndefinedConversionError for inbound emails (#13000) 2021-05-10 14:26:23 +10:00
helpers A11Y: sets the html lang to user's locale when possible (#12007) 2021-02-10 16:12:09 +01:00
import_export FEATURE: Rake task to export groups (#9450) 2020-04-17 14:59:54 -07:00
initializers FEATURE: A low priority filter for the review queue. (#12822) 2021-04-23 15:34:24 -03:00
integration DEV: Retry-after header values should be strings (#12475) 2021-03-23 20:32:36 +01:00
integrity FEATURE: Add anchor links to headings (#12379) 2021-03-23 10:45:06 +02:00
jobs FIX: Recalculate scores only when approving or transitioning to pending. (#13009) 2021-05-10 14:09:04 -03:00
lib DEV: Remove duplicate test (#12989) 2021-05-07 15:34:14 -06:00
mailers FEATURE: Send an email notification when a post is approved. (#12665) 2021-04-12 12:08:23 -03:00
models FIX: Wrong scope used for notification levels user serializer (#13039) 2021-05-14 09:45:14 +10:00
multisite DEV: Prevents rate limits for new feature checks on multisite (#12053) 2021-02-12 08:52:59 -05:00
requests FIX: Delete unconfirmed emails first if available (#13046) 2021-05-13 16:14:00 +10:00
script/import_scripts DEV: If disabled do not change setting after import (#12142) 2021-02-19 09:33:35 -07:00
serializers FIX: Wrong scope used for notification levels user serializer (#13039) 2021-05-14 09:45:14 +10:00
services DEV: Add service to validate email settings (#13021) 2021-05-13 15:11:23 +10:00
support DEV: remove unused Helpers::StubbedJob (#12960) 2021-05-06 13:04:41 +02:00
tasks FIX: remove migrate_from_s3 task that silently corrupts data (#11703) 2021-01-17 22:33:29 +01:00
views/omniauth_callbacks FEATURE: Use full page redirection for all external auth methods (#8092) 2019-10-08 12:10:43 +01:00
rails_helper.rb DEV: removes unused set_env (#12961) 2021-05-06 13:04:18 +02:00
swagger_helper.rb api docs example (#11997) 2021-02-08 10:09:44 -07:00