-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
7 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
|
@@ -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 GitHub Actions / Rubocop
|
||
|
@@ -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 GitHub Actions / Rubocop
|
||
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 GitHub Actions / Rubocop
|
||
end | ||
|
||
|