From 80339dd5733f196402af8a26e50270182cec7110 Mon Sep 17 00:00:00 2001 From: Jess Lee Date: Fri, 19 Oct 2018 16:16:43 -0400 Subject: [PATCH] Fix internal article query (#964) * update abuse report subject template * fix internal/article top month filters * update resolution email spec with proper subject line --- app/controllers/internal/articles_controller.rb | 2 +- app/helpers/feedback_messages_helper.rb | 2 +- spec/mailers/notify_mailer_spec.rb | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/internal/articles_controller.rb b/app/controllers/internal/articles_controller.rb index d226a3b52..023a6c928 100644 --- a/app/controllers/internal/articles_controller.rb +++ b/app/controllers/internal/articles_controller.rb @@ -17,7 +17,7 @@ class Internal::ArticlesController < Internal::ApplicationController per(50) when /top\-/ @articles = Article. - where("published_at > ?", params[:state].split("-")[1].to_f.months.ago). + where("published_at > ?", params[:state].split("-")[1].to_i.months.ago). includes(:user). includes(:buffer_updates). order("positive_reactions_count DESC"). diff --git a/app/helpers/feedback_messages_helper.rb b/app/helpers/feedback_messages_helper.rb index 457ca801f..e680f17a2 100644 --- a/app/helpers/feedback_messages_helper.rb +++ b/app/helpers/feedback_messages_helper.rb @@ -11,7 +11,7 @@ module FeedbackMessagesHelper dev.to team HEREDOC { - subject: "dev.to Status Update", + subject: "DEV Report Status Update", body: body }.freeze end diff --git a/spec/mailers/notify_mailer_spec.rb b/spec/mailers/notify_mailer_spec.rb index 54aba188b..482adc017 100644 --- a/spec/mailers/notify_mailer_spec.rb +++ b/spec/mailers/notify_mailer_spec.rb @@ -76,7 +76,7 @@ RSpec.describe NotifyMailer, type: :mailer do def params(user_email, feedback_message_id) { email_to: user_email, - email_subject: "dev.to Status Update", + email_subject: "DEV Report Status Update", email_body: "You've violated our code of conduct", email_type: "Reporter", feedback_message_id: feedback_message_id @@ -87,7 +87,7 @@ RSpec.describe NotifyMailer, type: :mailer do feedback_message = create(:feedback_message, :abuse_report, reporter_id: user.id) feedback_message_resolution_email = described_class. feedback_message_resolution_email(params(user.email, feedback_message.id)) - expect(feedback_message_resolution_email.subject).to eq "dev.to Status Update" + expect(feedback_message_resolution_email.subject).to eq "DEV Report Status Update" end it "renders proper receiver" do @@ -115,6 +115,7 @@ RSpec.describe NotifyMailer, type: :mailer do describe "#mentee_email" do let(:mentee) { create(:user) } let(:mentor) { create(:user) } + it "renders proper subject" do mentee_email = described_class.mentee_email(mentee, mentor) expect(mentee_email.subject).to eq "You have been matched with a DEV mentor!" @@ -128,6 +129,7 @@ RSpec.describe NotifyMailer, type: :mailer do describe "#mentor_email" do let(:mentee) { create(:user) } let(:mentor) { create(:user) } + it "renders proper subject" do mentor_email = described_class.mentor_email(mentor, mentee) expect(mentor_email.subject).to eq "You have been matched with a new DEV mentee!"