Skip to content

Commit

Permalink
Improvement #1896: reverse conversations order and put form on top (#…
Browse files Browse the repository at this point in the history
…1930)

Reverses the order of the conversations on the new introduced view and
puts the message box on the top to improve usability as being requested
by the users

---------

Co-authored-by: Robert Schäfer <git@roschaefer.de>
  • Loading branch information
soey and roschaefer authored Jul 23, 2024
1 parent b58246b commit 9869428
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion app/models/contributor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def conversations
Message
.where(recipient: self)
.or(Message.where(sender: self))
.reorder(created_at: :asc)
end

def conversation_about(request)
Expand Down
2 changes: 1 addition & 1 deletion app/views/contributors/conversations.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<%= c 'section', style: :xlargeSpaceBetween do %>
<%= c 'contributor_metrics', contributor_for_info: @contributor, style: :cards %>
<h2><%= t('.heading', name: @contributor.name ) %></h2>
<%= c 'chat_messages', messages: @messages, styles: [:compact] %>
<%= c 'chat_form', contributor: @contributor, reply_to: @reply_to %>
<%= c 'chat_messages', messages: @messages, styles: [:compact] %>
<% end %>
<% end %>
6 changes: 3 additions & 3 deletions spec/models/contributor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@
expect(contributor.conversations).to include(sent_message)
end

it 'sorts the messages so that the oldest first' do
it 'sorts the messages so that the newest comes first' do
received_message
sent_message
expect(contributor.conversations.first).to eql(received_message)
expect(contributor.conversations.last).to eql(sent_message)
expect(contributor.conversations.last).to eql(received_message)
expect(contributor.conversations.first).to eql(sent_message)
end

it 'does not include messages not being sent or received by the contributor' do
Expand Down

0 comments on commit 9869428

Please sign in to comment.