$(".user-button").before(data.inboxanchor);
$("#inbox-count").replaceWith(data.inbox_count);
+ $("#outbox-count").replaceWith(data.outbox_count);
+ $("#muted-count").replaceWith(data.muted_count);
}
function updateReadState(target, isRead) {
-<p id="inbox-count">
+<h4 id="inbox-count">
<%= t "messages.inbox.messages",
:new_messages => t("messages.inbox.new_messages",
:count => current_user.new_messages.size),
:old_messages => t("messages.inbox.old_messages",
:count => current_user.messages.size - current_user.new_messages.size) %>
-</p>
+</h4>
--- /dev/null
+<h4 id="muted-count">
+<%= t "messages.muted.messages", :count => current_user.muted_messages.size %>
+</h4>
--- /dev/null
+<h4 id="outbox-count">
+<%= t "messages.outbox.messages", :count => current_user.sent_messages.size %>
+</h4>
json.inboxanchor render(:partial => "layouts/inbox")
-json.inbox_count render(:partial => "message_count")
+json.inbox_count render(:partial => "inbox_count")
+json.outbox_count render(:partial => "outbox_count")
+json.muted_count render(:partial => "muted_count")
<%= render :partial => "heading", :locals => { :active_link_path => inbox_messages_path } %>
-<h4><%= render :partial => "message_count" %></h4>
+<%= render :partial => "inbox_count" %>
<% if current_user.messages.size > 0 %>
<%= render :partial => "messages_table", :locals => { :columns => %w[from subject date], :messages => current_user.messages, :inner_partial => "message_summary" } %>
json.inboxanchor render(:partial => "layouts/inbox")
-json.inbox_count render(:partial => "message_count")
+json.inbox_count render(:partial => "inbox_count")
+json.outbox_count render(:partial => "outbox_count")
+json.muted_count render(:partial => "muted_count")
<%= render :partial => "heading", :locals => { :active_link_path => muted_messages_path } %>
-<h4><%= t ".messages", :count => current_user.muted_messages.size %></h4>
+<%= render :partial => "muted_count" %>
<%= render :partial => "messages_table", :locals => { :columns => %w[from subject date], :messages => current_user.muted_messages, :inner_partial => "message_summary" } %>
<%= render :partial => "heading", :locals => { :active_link_path => outbox_messages_path } %>
-<h4><%= t ".messages", :count => current_user.sent_messages.size %></h4>
+<%= render :partial => "outbox_count" %>
<% if current_user.sent_messages.size > 0 %>
<%= render :partial => "messages_table", :locals => { :columns => %w[to subject date], :messages => current_user.sent_messages, :inner_partial => "sent_message_summary" } %>
--- /dev/null
+require "application_system_test_case"
+
+class NoteCommentsTest < ApplicationSystemTestCase
+ def test_delete_received_message
+ user = create(:user)
+ create(:message, :recipient => user)
+ sign_in_as(user)
+
+ visit inbox_messages_path
+ assert_text "You have 1 new message and 0 old messages"
+
+ click_button "Delete"
+ assert_text "You have 0 new messages and 0 old messages"
+ end
+
+ def test_delete_sent_message
+ user = create(:user)
+ create(:message, :sender => user)
+ sign_in_as(user)
+
+ visit outbox_messages_path
+ assert_text "You have 1 sent message"
+
+ click_button "Delete"
+ assert_text "You have 0 sent messages"
+ end
+
+ def test_delete_muted_message
+ user = create(:user)
+ muted_user = create(:user)
+ create(:user_mute, :owner => user, :subject => muted_user)
+ create(:message, :sender => muted_user, :recipient => user)
+ sign_in_as(user)
+
+ visit muted_messages_path
+ assert_text "1 muted message"
+
+ click_button "Delete"
+ assert_text "0 muted messages"
+ end
+end