Browse Source

Autofix Rubocop Rails/FindById (#23762)

closed-social-glitch-2
Nick Schonning 1 year ago
committed by GitHub
parent
commit
434770f580
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 9 deletions
  1. +0
    -7
      .rubocop_todo.yml
  2. +1
    -1
      app/controllers/api/v1/notifications_controller.rb
  3. +1
    -1
      app/controllers/media_controller.rb

+ 0
- 7
.rubocop_todo.yml View File

@ -1645,13 +1645,6 @@ Rails/FilePath:
- 'spec/rails_helper.rb'
- 'spec/spec_helper.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Rails/FindById:
Exclude:
- 'app/controllers/api/v1/notifications_controller.rb'
- 'app/controllers/media_controller.rb'
# Offense count: 6
# Configuration parameters: Include.
# Include: app/models/**/*.rb

+ 1
- 1
app/controllers/api/v1/notifications_controller.rb View File

@ -24,7 +24,7 @@ class Api::V1::NotificationsController < Api::BaseController
end
def dismiss
current_account.notifications.find_by!(id: params[:id]).destroy!
current_account.notifications.find(params[:id]).destroy!
render_empty
end

+ 1
- 1
app/controllers/media_controller.rb View File

@ -32,7 +32,7 @@ class MediaController < ApplicationController
scope = MediaAttachment.local.attached
# If id is 19 characters long, it's a shortcode, otherwise it's an identifier
@media_attachment = id.size == 19 ? scope.find_by!(shortcode: id) : scope.find_by!(id: id)
@media_attachment = id.size == 19 ? scope.find_by!(shortcode: id) : scope.find(id)
end
def verify_permitted_status!

Loading…
Cancel
Save