Skip to content

Commit f5fd4f7

Browse files
committed
use the error method everywhere
1 parent 4fbe3e3 commit f5fd4f7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

changelogger/app/controllers/webhooks_controller.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ class WebhooksController < ApplicationController
55
# before_action :verify_event_type!
66

77
def create
8-
# return error(:labeled) unless labeled?
9-
# return error(:closed) unless closed?
10-
# return error(:merged) unless merged_into_master?
8+
# return error("not labeled") unless labeled?
9+
# return error("not closed") unless closed?
10+
# return error("not merged") unless merged_into_master?
1111

1212
# create_changelog_entry
1313

@@ -24,15 +24,15 @@ def payload
2424
end
2525

2626
def error(msg)
27-
text = "Webhook failed: not_#{msg}"
27+
text = "Webhook invalid: #{msg}"
2828
puts text
2929
render(status: 422, json: text)
3030
end
3131

3232
# def verify_event_type!
3333
# type = request.headers["HTTP_X_GITHUB_EVENT"]
3434
# return if type == "pull_request"
35-
# render(status: 422, json: "unallowed event type: #{type}")
35+
# error("unallowed event type: #{type}")
3636
# end
3737

3838
# def labeled?
@@ -115,7 +115,7 @@ def error(msg)
115115

116116
# unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])
117117
# guid = request.headers["HTTP_X_GITHUB_DELIVERY"]
118-
# render(status: 422, json: "unable to verify payload for #{guid}")
118+
# error("unable to verify payload for #{guid}")
119119
# end
120120
# end
121121
end

0 commit comments

Comments
 (0)