Skip to content

Commit f279961

Browse files
committed
minor fixes to message display - fixes #7806
1 parent afcd53c commit f279961

File tree

5 files changed

+29
-9
lines changed

5 files changed

+29
-9
lines changed

app/controllers/me/posts_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def index
1818
@other_user = @recipient
1919
@discussion.mark!(:read, current_user)
2020
@posts = @discussion.posts.paginate(post_pagination_params)
21+
@post = Post.new
2122
end
2223

2324
def create

app/models/notice/private_message_notice.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def display_body_as_quote?
3131

3232
def display_body
3333
# this is now post.body_html
34-
data[:message]
34+
# it's html safe because it's the Greencloth output.
35+
data[:message].html_safe
3536
end
3637

3738
def button_text

app/views/me/discussions/_message_form.html.haml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
- text = ""
55
- recipient_name = ""
6-
- text_area = text_area_tag('post[body]', text, id: 'say_msg', rows: '8')
6+
- text_area = text_area_tag('post[body]', text, id: 'post_body', rows: '8')
77
- send_button = button_to_function(:send_button.t, send_message_function(recipient_name))
88

99
= form_tag('', id: 'say_form') do

app/views/me/notices/_notice.html.haml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
%br
77
%span{style: 'font-size:85%'}= friendly_date notice.created_at
88
%td.icon.small{style: avatar_style(notice, 'small')}
9-
=h embold_links notice.display_title
10-
%br
11-
- # TODO truncate messes up HTML, and we maybe should have a scroll bar instead of using truncate anyway.
12-
- if notice.display_body_as_quote?
13-
%i=h truncate(embold_links(notice.display_body), length: 512)
14-
- else
15-
=h truncate(embold_links(notice.display_body), length: 512)
9+
%div{style: "max-height: 80px; overflow-y: auto;"}
10+
=h embold_links notice.display_title
11+
%br
12+
- if notice.display_body_as_quote?
13+
%i= embold_links(notice.display_body)
14+
- else
15+
= embold_links(notice.display_body)
1616
%td.nowrap.align_right.reflow
1717
= spinner(notice, align: :middle)
1818
- url = self.send(notice.noticable_path, notice.noticable)

test/integration/message_test.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require 'javascript_integration_test'
2+
3+
class MessageTest < JavascriptIntegrationTest
4+
5+
6+
def test_sending_message
7+
msg = "Here is my Message"
8+
login users(:blue)
9+
click_on 'Messages'
10+
click_on 'Send Message'
11+
fill_in 'Recipient', with: 'red'
12+
fill_in 'Message', with: msg
13+
click_on 'Send'
14+
assert_content msg
15+
end
16+
17+
end
18+

0 commit comments

Comments
 (0)