Skip to content

Commit

Permalink
now silently fall back to untagged if an invalid/forbidden tag is use…
Browse files Browse the repository at this point in the history
…d in meeting_starter.rb (which matches what the user would see in terms of UI, namely the default tag name)
  • Loading branch information
Ithanil committed Jul 16, 2024
1 parent c870c53 commit 2928003
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/controllers/api/v1/server_tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ module Api
module V1
class ServerTagsController < ApiController
# GET /api/v1/server_tags.json
# Returns a list of all allowed tags for the current user
# Returns a list of all allowed tags&names for the current user
def index
tags = Rails.configuration.server_tag_names
tag_names = Rails.configuration.server_tag_names
tag_roles = Rails.configuration.server_tag_roles
tags.delete_if { |tag, _| tag_roles.key?(tag) && tag_roles[tag].exclude?(current_user.role_id) }
tag_names.delete_if { |tag, _| tag_roles.key?(tag) && tag_roles[tag].exclude?(current_user.role_id) }

render_data data: tags, status: :ok
render_data data: tag_names, status: :ok
end
end
end
Expand Down
9 changes: 7 additions & 2 deletions app/services/meeting_starter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,15 @@ def computed_options(access_code:)

def handle_server_tag(meeting_options:)
if meeting_options['serverTag'].present?
tag_names = Rails.configuration.server_tag_names
tag_roles = Rails.configuration.server_tag_roles
tag = meeting_options.delete('serverTag')
tag_required = meeting_options.delete('serverTagRequired')
tag_param = tag_required == 'true' ? "#{tag} !" : tag
meeting_options.store('meta_server-tag', tag_param) if Rails.configuration.server_tag_names.key?(tag)

if tag_names.key?(tag) && !(tag_roles.key?(tag) && tag_roles[tag].exclude?(@current_user.role_id))
tag_param = tag_required == 'true' ? "#{tag} !" : tag
meeting_options.store('meta_server-tag', tag_param)
end
else
meeting_options.delete('serverTag')
meeting_options.delete('serverTagRequired')
Expand Down

0 comments on commit 2928003

Please sign in to comment.