-
Notifications
You must be signed in to change notification settings - Fork 924
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/pull/5448'
- Loading branch information
Showing
21 changed files
with
205 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Messages | ||
class InboxesController < MailboxesController | ||
# Display the list of messages that have been sent to the user. | ||
def show | ||
@title = t ".title" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Messages | ||
class MailboxesController < ApplicationController | ||
layout "site" | ||
|
||
before_action :authorize_web | ||
before_action :set_locale | ||
|
||
authorize_resource :class => Message | ||
|
||
before_action :check_database_readable | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Messages | ||
class MutedInboxesController < MailboxesController | ||
# Display the list of muted messages received by the user. | ||
def show | ||
@title = t ".title" | ||
|
||
redirect_to messages_inbox_path if current_user.muted_messages.none? | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Messages | ||
class OutboxesController < MailboxesController | ||
# Display the list of messages that the user has sent to other users. | ||
def show | ||
@title = t ".title" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require "test_helper" | ||
|
||
module Messages | ||
class InboxesControllerTest < ActionDispatch::IntegrationTest | ||
## | ||
# test all routes which lead to this controller | ||
def test_routes | ||
assert_routing( | ||
{ :path => "/messages/inbox", :method => :get }, | ||
{ :controller => "messages/inboxes", :action => "show" } | ||
) | ||
end | ||
|
||
def test_show | ||
user = create(:user) | ||
read_message = create(:message, :read, :recipient => user) | ||
|
||
session_for(user) | ||
|
||
get messages_inbox_path | ||
assert_response :success | ||
assert_select ".content-inner > table.messages-table > tbody", :count => 1 do | ||
assert_select "tr", :count => 1 | ||
assert_select "tr#inbox-#{read_message.id}", :count => 1 do | ||
assert_select "a[href='#{user_path read_message.sender}']", :text => read_message.sender.display_name | ||
assert_select "a[href='#{message_path read_message}']", :text => read_message.title | ||
end | ||
end | ||
end | ||
|
||
def test_show_requires_login | ||
get messages_inbox_path | ||
assert_redirected_to login_path(:referer => messages_inbox_path) | ||
end | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
test/controllers/messages/muted_inboxes_controller_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require "test_helper" | ||
|
||
module Messages | ||
class MutedInboxesControllerTest < ActionDispatch::IntegrationTest | ||
## | ||
# test all routes which lead to this controller | ||
def test_routes | ||
assert_routing( | ||
{ :path => "/messages/muted", :method => :get }, | ||
{ :controller => "messages/muted_inboxes", :action => "show" } | ||
) | ||
end | ||
end | ||
end |
Oops, something went wrong.