Temporarily remove email notification and status page (#657)

This commit is contained in:
Andy Zhao 2018-08-06 10:53:43 -04:00 committed by Ben Halpern
parent 05789f6ef6
commit 468ffd5fc2
3 changed files with 9 additions and 7 deletions

View file

@ -5,11 +5,12 @@ class FeedbackMessagesController < ApplicationController
def create
flash.clear
@feedback_message = FeedbackMessage.new(
feedback_message_params.merge(reporter_id: current_user&.id))
feedback_message_params.merge(reporter_id: current_user&.id),
)
if recaptcha_verified? && @feedback_message.save
send_slack_message
NotifyMailer.new_report_email(@feedback_message).deliver if @feedback_message.reporter_id?
redirect_to @feedback_message.path
# NotifyMailer.new_report_email(@feedback_message).deliver if @feedback_message.reporter_id?
redirect_to "/feedback_messages"
elsif feedback_message_params[:feedback_type] == "bug-reports"
flash[:notice] = "Make sure the forms are filled 🤖 "
render file: "public/500.html", status: 500, layout: false
@ -27,13 +28,14 @@ class FeedbackMessagesController < ApplicationController
private
def recaptcha_verified?
params["g-recaptcha-response"] && verify_recaptcha(secret_key: ApplicationConfig["RECAPTCHA_SECRET"])
params["g-recaptcha-response"] &&
verify_recaptcha(secret_key: ApplicationConfig["RECAPTCHA_SECRET"])
end
def send_slack_message
SlackBot.ping(
generate_message,
channel: "#{feedback_message_params[:feedback_type]}",
channel: feedback_message_params[:feedback_type].to_s,
username: "#{feedback_message_params[:feedback_type]}_bot",
icon_emoji: ":#{emoji_for_feedback(feedback_message_params[:feedback_type])}:",
)

View file

@ -1,6 +1,6 @@
<div class="dialog">
<div>
<h2>Thank you for your report. You can view the <br><a href="<%= @feedback_message.path %>">status of your report here.</a></h2>
<h2>Thank you for your report.</a></h2>
<h3><a href="/">Return to home page</a></h3>
</div>
</div>

View file

@ -78,7 +78,7 @@ Rails.application.routes.draw do
resources :comments, only: [:create,:update,:destroy]
resources :users, only: [:update]
resources :reactions, only: [:index, :create]
resources :feedback_messages, only: [:create]
resources :feedback_messages, only: [:create, :index]
get "/reports/:slug", to: "feedback_messages#show"
resources :organizations, only: [:update, :create]
resources :followed_articles, only: [:index]