attachments for new conversations

fixes CNVS-7329

test plan
- from new conversations ui, send a message with attachments
- ensure the message sends with the attachments

Change-Id: Ic5a57caf4aa9ee61ac7da6e335bce68bdeef15c4
Reviewed-on: https://gerrit.instructure.com/23290
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
This commit is contained in:
Joel Hough 2013-08-13 16:15:55 -06:00
parent feaf930041
commit 2cbaf7db9a
4 changed files with 29 additions and 18 deletions

View File

@ -153,7 +153,7 @@ require [
@header.render()
_initComposeDialog: ->
@compose = new MessageFormDialog(courses: @courses) #this, this.canAddNotesFor, folderId: @options.FOLDER_ID)
@compose = new MessageFormDialog(courses: @courses, folderId: ENV.CONVERSATIONS.ATTACHMENTS_FOLDER_ID)
window.conversationsRouter = new ConversationsRouter
Backbone.history.start()

View File

@ -198,7 +198,8 @@ define [
@$addMediaComment[if !!INST.kalturaSettings then 'show' else 'hide']()
@$form.formSubmit
fileUpload: => (@$fullDialog.find(".file_input").length > 0)
fileUpload: => (@$fullDialog.find(".attachment_list").length > 0)
files: => (@$fullDialog.find(".file_input"))
preparedFileUpload: true
context_code: "user_" + ENV.current_user_id
folder_id: @options.folderId

View File

@ -138,27 +138,36 @@ class ConversationsController < ApplicationController
render :json => @conversations_json
else
return redirect_to conversations_path(:scope => params[:redirect_scope]) if params[:redirect_scope]
return render :template => 'conversations/index_new' if @current_user.use_new_conversations?
@current_user.reset_unread_conversations_counter
load_all_contexts :permissions => [:manage_user_notes]
notes_enabled = @current_user.associated_accounts.any?{|a| a.enable_user_notes }
can_add_notes_for_account = notes_enabled && @current_user.associated_accounts.any?{|a| a.grants_right?(@current_user, nil, :manage_students) }
hash = {:CONVERSATIONS => {
:USER => conversation_users_json([@current_user], @current_user, session, :include_participant_contexts => false).first,
:CONTEXTS => @contexts,
:NOTES_ENABLED => notes_enabled,
:CAN_ADD_NOTES_FOR_ACCOUNT => can_add_notes_for_account,
:SHOW_INTRO => !@current_user.watched_conversations_intro?,
:FOLDER_ID => @current_user.conversation_attachments_folder.id,
:MEDIA_COMMENTS_ENABLED => feature_enabled?(:kaltura),
}, :CONTEXT_ACTION_SOURCE => :conversation}
append_sis_data(hash)
js_env(hash)
if @current_user.use_new_conversations?
js_env(:CONVERSATIONS => {
:ATTACHMENTS_FOLDER_ID => @current_user.conversation_attachments_folder.id
})
return render :template => 'conversations/index_new'
else
@current_user.reset_unread_conversations_counter
load_all_contexts :permissions => [:manage_user_notes]
notes_enabled = @current_user.associated_accounts.any?{|a| a.enable_user_notes }
can_add_notes_for_account = notes_enabled && @current_user.associated_accounts.any?{|a| a.grants_right?(@current_user, nil, :manage_students) }
hash = {:CONVERSATIONS => {
:USER => conversation_users_json([@current_user], @current_user, session, :include_participant_contexts => false).first,
:CONTEXTS => @contexts,
:NOTES_ENABLED => notes_enabled,
:CAN_ADD_NOTES_FOR_ACCOUNT => can_add_notes_for_account,
:SHOW_INTRO => !@current_user.watched_conversations_intro?,
:FOLDER_ID => @current_user.conversation_attachments_folder.id,
:MEDIA_COMMENTS_ENABLED => feature_enabled?(:kaltura),
}, :CONTEXT_ACTION_SOURCE => :conversation}
append_sis_data(hash)
js_env(hash)
end
end
end
# New Conversations UI. When finished, move back to index action.
def index_new
js_env(:CONVERSATIONS => {
:ATTACHMENTS_FOLDER_ID => @current_user.conversation_attachments_folder.id
})
return unless authorized_action(Account.site_admin, @current_user, :become_user)
end

View File

@ -188,6 +188,7 @@ define([
intent: options.intent,
folder_id: $.isFunction(options.folder_id) ? (options.folder_id.call($form)) : options.folder_id,
file_elements: $form.find("input[type='file']:visible"),
files: $.isFunction(options.files) ? (options.files.call($form)) : options.files,
url: (options.upload_only ? null : action),
method: options.method,
uploadDataUrl: options.uploadDataUrl,