fix conversation paging regression
Change-Id: I08a2758c4dd6a575327aa18c2d0342a23d687454 Reviewed-on: https://gerrit.instructure.com/5786 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com>
This commit is contained in:
parent
488da4fd2e
commit
0a32371e13
|
@ -1491,7 +1491,7 @@ I18n.scoped 'conversations', (I18n) ->
|
|||
container: $conversation_list
|
||||
params:
|
||||
format: 'json'
|
||||
per_page: 25
|
||||
per_page: MessageInbox.conversations_per_page
|
||||
loader: $("#conversations_loader")
|
||||
scrape: (data) ->
|
||||
if typeof(data) == 'string'
|
||||
|
|
|
@ -89,7 +89,7 @@ class ConversationsController < ApplicationController
|
|||
# }
|
||||
# ]
|
||||
def index
|
||||
@page_max = params[:per_page] = params[:per_page].try(:to_i) || 10
|
||||
@page_max = params[:per_page] = 25 if params[:format] != 'json'
|
||||
conversations_scope = case params[:scope]
|
||||
when 'unread'
|
||||
@view_name = I18n.t('index.inbox_views.unread', 'Unread')
|
||||
|
|
|
@ -225,6 +225,7 @@
|
|||
<% # TODO: get note-enabled-ness per account, and cross reference with the recipient's associated account ids. this is already enforced in the model %>
|
||||
MessageInbox.notes_enabled = <%= raw @current_user.associated_accounts.any?{|a| a.enable_user_notes } %>;
|
||||
MessageInbox.can_add_notes_for_account = MessageInbox.notes_enabled && <%= raw @current_user.associated_accounts.any?{|a| a.grants_right?(@current_user, nil, :manage_students) } %>;
|
||||
MessageInbox.conversations_per_page = <%= @page_max.to_i %>;
|
||||
<% unless @current_user.watched_conversations_intro? %>
|
||||
$.conversationsIntroSlideshow()
|
||||
<% end %>
|
||||
|
|
|
@ -2020,7 +2020,7 @@
|
|||
container: $conversation_list,
|
||||
params: {
|
||||
format: 'json',
|
||||
per_page: 25
|
||||
per_page: MessageInbox.conversations_per_page
|
||||
},
|
||||
loader: $("#conversations_loader"),
|
||||
scrape: function(data) {
|
||||
|
|
|
@ -40,14 +40,6 @@ describe ConversationsController, :type => :integration do
|
|||
u
|
||||
end
|
||||
|
||||
def conversation(*users)
|
||||
options = users.last.is_a?(Hash) ? users.pop : {}
|
||||
@conversation = (options.delete(:sender) || @me).initiate_conversation(users.map(&:id))
|
||||
@conversation.add_message('test')
|
||||
@conversation.update_attributes(options)
|
||||
@conversation.reload
|
||||
end
|
||||
|
||||
context "conversations" do
|
||||
it "should return the conversation list" do
|
||||
@c1 = conversation(@bob, :workflow_state => 'read', :label => "blue")
|
||||
|
|
|
@ -3,6 +3,26 @@ require File.expand_path(File.dirname(__FILE__) + '/common')
|
|||
shared_examples_for "conversations selenium tests" do
|
||||
it_should_behave_like "in-process server selenium tests"
|
||||
|
||||
context "conversation loading" do
|
||||
before do
|
||||
course_with_teacher_logged_in
|
||||
@user.watched_conversations_intro
|
||||
@user.save
|
||||
end
|
||||
|
||||
it "should load all conversations" do
|
||||
@me = @user
|
||||
num = 51
|
||||
num.times { conversation(@me, user) }
|
||||
get "/conversations"
|
||||
keep_trying_until{
|
||||
elements = find_all_with_jquery("#conversations > ul > li:visible")
|
||||
elements.last.location_once_scrolled_into_view
|
||||
elements.size == num
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
context "attachments" do
|
||||
def new_conversation
|
||||
get "/conversations"
|
||||
|
|
|
@ -257,6 +257,14 @@ Spec::Runner.configure do |config|
|
|||
user_session(@user)
|
||||
end
|
||||
|
||||
def conversation(*users)
|
||||
options = users.last.is_a?(Hash) ? users.pop : {}
|
||||
@conversation = (options.delete(:sender) || @me || users.shift).initiate_conversation(users.map(&:id))
|
||||
@conversation.add_message('test')
|
||||
@conversation.update_attributes(options)
|
||||
@conversation.reload
|
||||
end
|
||||
|
||||
def assert_status(status=500)
|
||||
response.status.to_i.should eql(status)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue