Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Fix crash on webhooks create/destroy CSV activities
Browse files Browse the repository at this point in the history
I'm also adding a template for 500 status code for CSV.

Fixes #994

Signed-off-by: Miquel Sabaté Solà <[email protected]>
  • Loading branch information
mssola committed Jul 19, 2016
1 parent a53a733 commit 702356b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# configurations too. Moreover, this way we get richer pages while sharing as
# much code as possible.
class ErrorsController < ApplicationController
respond_to :html, :csv

skip_before_action :check_requirements
skip_before_action :authenticate_user!
skip_before_action :force_update_profile!
Expand Down
1 change: 1 addition & 0 deletions app/views/errors/500.csv.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Internal Server Error
5 changes: 4 additions & 1 deletion app/views/public_activity/webhook/_create.csv.slim
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
= CSV.generate_line(['webhook', activity.trackable.url, 'create', '-', activity.owner.username, activity.created_at, "owned by namespace #{activity.trackable.namespace.name}"])
- if activity.trackable
= CSV.generate_line(['webhook', activity.trackable.url, 'create', '-', activity.owner.username, activity.created_at, "owned by namespace #{activity.trackable.namespace.name}"])
- else
= CSV.generate_line(['webhook', activity.parameters[:webhook_host], 'create', '-', activity.owner.username, activity.created_at, "owned by namespace #{activity.parameters[:namespace_name]}"])
2 changes: 1 addition & 1 deletion app/views/public_activity/webhook/_destroy.csv.slim
Original file line number Diff line number Diff line change
@@ -1 +1 @@
= CSV.generate_line(["webhook", activity.trackable.url, "destroy", "-", activity.owner.username, activity.created_at, "owned by namespace #{activity.trackable.namespace.name}"])
= CSV.generate_line(["webhook", activity.parameters[:webhook_host], "destroy", "-", activity.owner.username, activity.created_at, "owned by namespace #{activity.parameters[:namespace_name]}"])

0 comments on commit 702356b

Please sign in to comment.