Fix internal article query (#964)

* update abuse report subject template

* fix internal/article top month filters

* update resolution email spec with proper subject line
This commit is contained in:
Jess Lee 2018-10-19 16:16:43 -04:00 committed by Ben Halpern
parent 2136b105a3
commit 80339dd573
3 changed files with 6 additions and 4 deletions

View file

@ -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").

View file

@ -11,7 +11,7 @@ module FeedbackMessagesHelper
dev.to team
HEREDOC
{
subject: "dev.to Status Update",
subject: "DEV Report Status Update",
body: body
}.freeze
end

View file

@ -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!"