Skip to content

Commit

Permalink
use render_error_flash_message_via_turbo_stream where scheme: :danger…
Browse files Browse the repository at this point in the history
… was used
  • Loading branch information
toy committed Dec 18, 2024
1 parent 5cbb651 commit 67d9e2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def destroy
.delete_branch(item: @active_item)
.either(
->(_) { update_via_turbo_stream(component: ItemsComponent.new(item: @active_item.parent)) },
->(errors) { render_flash_message_via_turbo_stream(message: errors.full_messages, scheme: :danger) }
->(errors) { render_error_flash_message_via_turbo_stream(message: errors.full_messages) }
)

respond_with_turbo_streams(&:html)
Expand Down
10 changes: 2 additions & 8 deletions app/controllers/work_packages/reminders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,7 @@ def destroy
render_success_flash_message_via_turbo_stream(message: I18n.t("work_package.reminders.success_deletion_message"))
respond_with_turbo_streams
else
render_flash_message_via_turbo_stream(
message: service_result.errors.full_messages,
scheme: :danger
)
render_error_flash_message_via_turbo_stream(message: service_result.errors.full_messages)
respond_with_turbo_streams(status: :unprocessable_entity)
end
end
Expand Down Expand Up @@ -167,10 +164,7 @@ def find_reminder
.upcoming_and_visible_to(User.current)
.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_flash_message_via_turbo_stream(
message: I18n.t(:error_reminder_not_found),
scheme: :danger
)
render_error_flash_message_via_turbo_stream(message: I18n.t(:error_reminder_not_found))
respond_with_turbo_streams(status: :not_found)
false
end
Expand Down

0 comments on commit 67d9e2d

Please sign in to comment.