Skip to content

Commit

Permalink
AO3-5502 satisfy more Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
slavalamp committed Jan 12, 2025
1 parent e94a4f8 commit e7e065f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions app/controllers/chapters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def manage
def show
@tag_groups = @work.tag_groups

if params[:selected_id]
redirect_to url_for(controller: :chapters, action: :show, work_id: @work.id, id: params[:selected_id]) and return
end
redirect_to url_for(controller: :chapters, action: :show, work_id: @work.id, id: params[:selected_id]) and return if params[:selected_id]

@chapters = @work.chapters_in_order(
include_content: false,
Expand Down Expand Up @@ -91,6 +89,7 @@ def new
# GET /work/:work_id/chapters/1/edit
def edit
return unless params["remove"] == "me"

@chapter.creatorships.for_user(current_user).destroy_all
if @work.chapters.any? { |c| current_user.is_author_of?(c) }
flash[:notice] = ts("You have been removed as a creator from the chapter.")

Check warning on line 95 in app/controllers/chapters_controller.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Prefer Rails built-in `t` helper over `ts` and move the text into the yml file. `ts` is not actually translatable. For more information, refer to https://github.com/otwcode/otwarchive/wiki/Internationalization-(i18n)-Standards Raw Output: app/controllers/chapters_controller.rb:95:24: C: I18n/DeprecatedHelper: Prefer Rails built-in `t` helper over `ts` and move the text into the yml file. `ts` is not actually translatable. For more information, refer to https://github.com/otwcode/otwarchive/wiki/Internationalization-(i18n)-Standards
Expand Down Expand Up @@ -266,16 +265,14 @@ def load_work
def load_chapter
@chapter = @work.chapters.find_by(id: params[:id])

unless @chapter
flash[:error] = ts("Sorry, we couldn't find the chapter you were looking for.")
redirect_to work_path(@work)
end
return if @chapter

flash[:error] = ts("Sorry, we couldn't find the chapter you were looking for.")

Check warning on line 270 in app/controllers/chapters_controller.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Prefer Rails built-in `t` helper over `ts` and move the text into the yml file. `ts` is not actually translatable. For more information, refer to https://github.com/otwcode/otwarchive/wiki/Internationalization-(i18n)-Standards Raw Output: app/controllers/chapters_controller.rb:270:21: C: I18n/DeprecatedHelper: Prefer Rails built-in `t` helper over `ts` and move the text into the yml file. `ts` is not actually translatable. For more information, refer to https://github.com/otwcode/otwarchive/wiki/Internationalization-(i18n)-Standards
redirect_to work_path(@work)
end

def post_chapter
unless @work.posted
@work.update_attribute(:posted, true)
end
@work.update_attribute(:posted, true) unless @work.posted
flash[:notice] = ts("Chapter has been posted!")

Check warning on line 276 in app/controllers/chapters_controller.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Prefer Rails built-in `t` helper over `ts` and move the text into the yml file. `ts` is not actually translatable. For more information, refer to https://github.com/otwcode/otwarchive/wiki/Internationalization-(i18n)-Standards Raw Output: app/controllers/chapters_controller.rb:276:22: C: I18n/DeprecatedHelper: Prefer Rails built-in `t` helper over `ts` and move the text into the yml file. `ts` is not actually translatable. For more information, refer to https://github.com/otwcode/otwarchive/wiki/Internationalization-(i18n)-Standards
end

Expand Down

0 comments on commit e7e065f

Please sign in to comment.