navigate to message fixed, changed to button
added spec to catch this regression in future
This commit is contained in:
parent
87e9e9d437
commit
6145e99baa
|
@ -54,7 +54,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td class='message'>
|
<td class='message'>
|
||||||
<div>{{#linkTo 'adminUser' user}}{{avatar user imageSize="small"}}{{/linkTo}} {{message}} <a href="{{unbound permalink}}">{{i18n admin.flags.view_message}}</a></div>
|
<div>{{#linkTo 'adminUser' user}}{{avatar user imageSize="small"}}{{/linkTo}} {{message}} <a href="{{unbound permalink}}"><button class='btn'>{{i18n admin.flags.view_message}}</button></a></div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
|
|
@ -327,13 +327,17 @@ class PostAction < ActiveRecord::Base
|
||||||
posts = post_ids.map{|id| post_lookup[id]}
|
posts = post_ids.map{|id| post_lookup[id]}
|
||||||
|
|
||||||
post_actions = actions.where(:post_id => post_ids)
|
post_actions = actions.where(:post_id => post_ids)
|
||||||
.select('post_actions.id,
|
# TODO this is so far from optimal, it should not be
|
||||||
post_actions.user_id,
|
# selecting all the columns but the includes stops working
|
||||||
post_action_type_id,
|
# with the code below
|
||||||
post_actions.created_at,
|
#
|
||||||
post_actions.post_id,
|
# .select('post_actions.id,
|
||||||
post_actions.message')
|
# post_actions.user_id,
|
||||||
.to_a
|
# post_action_type_id,
|
||||||
|
# post_actions.created_at,
|
||||||
|
# post_actions.post_id,
|
||||||
|
# post_actions.message')
|
||||||
|
# .to_a
|
||||||
|
|
||||||
post_actions.each do |pa|
|
post_actions.each do |pa|
|
||||||
post = post_lookup[pa.post_id]
|
post = post_lookup[pa.post_id]
|
||||||
|
|
|
@ -15,9 +15,15 @@ describe PostAction do
|
||||||
describe "flagged_posts_report" do
|
describe "flagged_posts_report" do
|
||||||
it "operates correctly" do
|
it "operates correctly" do
|
||||||
PostAction.act(codinghorror, post, PostActionType.types[:spam])
|
PostAction.act(codinghorror, post, PostActionType.types[:spam])
|
||||||
|
mod_message = PostAction.act(Fabricate(:user), post, PostActionType.types[:notify_moderators], message: "this post really sucks a lot I hate it")
|
||||||
|
|
||||||
posts, users = PostAction.flagged_posts_report("")
|
posts, users = PostAction.flagged_posts_report("")
|
||||||
posts.count.should == 1
|
posts.count.should == 1
|
||||||
users.count.should == 2
|
first = posts.first
|
||||||
|
|
||||||
|
users.count.should == 3
|
||||||
|
first[:post_actions].count.should == 2
|
||||||
|
first[:post_actions].first[:permalink].should == mod_message.related_post.topic.url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue