|
|
@ -25,7 +25,7 @@ module API |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
patch :star do |
|
|
|
patch :star do |
|
|
|
authorize(:queries, :star, project: @query.project, allow: allowed_to_manage_stars?) |
|
|
|
authorize(:queries, :star, context: @query.project, allow: allowed_to_manage_stars?) |
|
|
|
normalized_query_name = @query.name.parameterize.underscore |
|
|
|
normalized_query_name = @query.name.parameterize.underscore |
|
|
|
query_menu_item = MenuItems::QueryMenuItem.find_or_initialize_by_name_and_navigatable_id( |
|
|
|
query_menu_item = MenuItems::QueryMenuItem.find_or_initialize_by_name_and_navigatable_id( |
|
|
|
normalized_query_name, @query.id, title: @query.name |
|
|
|
normalized_query_name, @query.id, title: @query.name |
|
|
@ -35,7 +35,7 @@ module API |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
patch :unstar do |
|
|
|
patch :unstar do |
|
|
|
authorize(:queries, :unstar, project: @query.project, allow: allowed_to_manage_stars?) |
|
|
|
authorize(:queries, :unstar, context: @query.project, allow: allowed_to_manage_stars?) |
|
|
|
query_menu_item = @query.query_menu_item |
|
|
|
query_menu_item = @query.query_menu_item |
|
|
|
return @representer.to_json if @query.query_menu_item.nil? |
|
|
|
return @representer.to_json if @query.query_menu_item.nil? |
|
|
|
query_menu_item.destroy |
|
|
|
query_menu_item.destroy |
|
|
|