discourse/app/serializers/web_hook_user_serializer.rb
Alan Guo Xiang Tan 832b3b9e60
FEATURE: Remove support for legacy navigation menu (#23752)
Why this change?

Back in May 17 2023 along with the release of Discourse 3.1, we announced
on meta that the legacy hamburger dropdown navigation menu is
deprecated and will be dropped in Discourse 3.2. This is the link to the announcement
on meta: https://meta.discourse.org/t/removing-the-legacy-hamburger-navigation-menu-option/265274

## What does this change do?

This change removes the `legacy` option from the `navigation_menu` site
setting and migrates existing sites on the `legacy` option to the
`header dropdown` option.

All references to the `legacy` option in code and tests have been
removed as well.
2023-10-09 07:24:10 +08:00

60 lines
1.2 KiB
Ruby

# frozen_string_literal: true
class WebHookUserSerializer < UserSerializer
attributes :external_id
# remove staff attributes
def staff_attributes(*attrs)
end
%i[
unconfirmed_emails
can_edit
can_edit_username
can_edit_email
can_edit_name
can_send_private_messages
can_send_private_message_to_user
can_ignore_user
can_mute_user
ignored
uploaded_avatar_id
has_title_badges
bio_cooked
custom_fields
can_be_deleted
can_delete_all_posts
system_avatar_upload_id
gravatar_avatar_upload_id
custom_avatar_upload_id
can_change_bio
can_change_location
can_change_website
can_change_tracking_preferences
user_api_keys
group_users
user_auth_tokens
user_auth_token_logs
use_logo_small_as_avatar
pending_posts_count
status
display_sidebar_tags
sidebar_category_ids
sidebar_tags
].each { |attr| define_method("include_#{attr}?") { false } }
def include_email?
scope.is_admin?
end
alias_method :include_secondary_emails?, :include_email?
def include_external_id?
scope.is_admin? && object.single_sign_on_record
end
def external_id
object.single_sign_on_record.external_id
end
end