fix broken build
hack to allow for PMs with no users for flagging needs
This commit is contained in:
parent
32e3e3f382
commit
641c51367a
|
@ -96,13 +96,10 @@ class PostAction < ActiveRecord::Base
|
|||
|
||||
return unless opts[:message] && [:notify_moderators, :notify_user].include?(post_action_type)
|
||||
|
||||
target_usernames = nil
|
||||
# this is a hack to allow a PM with no reciepients, we should think through
|
||||
# a cleaner technique, a PM with myself is valid for flagging
|
||||
target_usernames = post_action_type == :notify_user ? post.user.username : "x"
|
||||
|
||||
if post_action_type == :notify_moderators
|
||||
target_usernames = "community"
|
||||
else
|
||||
target_usernames = post.user.username
|
||||
end
|
||||
title = I18n.t("post_action_types.#{post_action_type}.email_title",
|
||||
title: post.topic.title)
|
||||
body = I18n.t("post_action_types.#{post_action_type}.email_body",
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# kind of odd, but we need it, we also need to nuke usage of User from inside migrations
|
||||
# very poor form
|
||||
User.reset_column_information
|
||||
user = User.where("id <> -1 and username_lower = 'system'").first
|
||||
if user
|
||||
user.username = UserNameSuggester.suggest("system")
|
||||
|
|
|
@ -43,7 +43,7 @@ describe PostAction do
|
|||
PostAction.stubs(:create)
|
||||
end
|
||||
|
||||
it "sends an email to community if selected" do
|
||||
it "creates a pm if selected" do
|
||||
post = build(:post, id: 1000)
|
||||
PostCreator.any_instance.expects(:create).returns(post)
|
||||
PostAction.act(build(:user), build(:post), PostActionType.types[:notify_moderators], message: "this is my special message");
|
||||
|
|
Loading…
Reference in New Issue