navigate to message fixed, changed to button

added spec to catch this regression in future
This commit is contained in:
Sam 2013-06-27 16:58:35 +10:00
parent 87e9e9d437
commit 6145e99baa
3 changed files with 19 additions and 9 deletions

View File

@ -54,7 +54,7 @@
<tr>
<td></td>
<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>

View File

@ -327,13 +327,17 @@ class PostAction < ActiveRecord::Base
posts = post_ids.map{|id| post_lookup[id]}
post_actions = actions.where(:post_id => post_ids)
.select('post_actions.id,
post_actions.user_id,
post_action_type_id,
post_actions.created_at,
post_actions.post_id,
post_actions.message')
.to_a
# TODO this is so far from optimal, it should not be
# selecting all the columns but the includes stops working
# with the code below
#
# .select('post_actions.id,
# post_actions.user_id,
# post_action_type_id,
# post_actions.created_at,
# post_actions.post_id,
# post_actions.message')
# .to_a
post_actions.each do |pa|
post = post_lookup[pa.post_id]

View File

@ -15,9 +15,15 @@ describe PostAction do
describe "flagged_posts_report" do
it "operates correctly" do
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.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