fix discussion entry form quota error handling

test plan:
* create a student with their files over quota
(the easiest way to do this would probably be to edit
 the "User" quota setting for the account to a low number
 temporarily)
* create a course for the student, and enable
 "Let students attach files to discussion"
 (in More Options)
* create and publish a discussion topic

* as the student try to attach a file to a reply
 to the topic
* it should show an error (instead of pretending to
succeed and disappearing the entry)

closes #CNVS-27062

Change-Id: I33491bc390e429ec5e9bd8b9b7203ba8b874719a
Reviewed-on: https://gerrit.instructure.com/71630
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
This commit is contained in:
James Williams 2016-02-05 13:25:05 -07:00
parent 5de8ddef04
commit 410bbb8bfe
1 changed files with 10 additions and 3 deletions

View File

@ -10,6 +10,7 @@ define [
'compiled/views/editor/KeyboardShortcuts'
'str/stripTags'
'tinymce.editor_box'
'jquery.instructure_forms'
], (Backbone, _, I18n, $, Entry, htmlEscape, replyAttachmentTemplate, preventDefault, KeyboardShortcuts, stripTags) ->
class Reply
@ -126,9 +127,15 @@ define [
# Callback when the model is succesfully saved
#
# @api private
onPostReplySuccess: (entry) =>
@view.model.set 'notification', ''
@trigger 'save', entry
onPostReplySuccess: (entry, response) =>
if response.errors
@hideNotification()
@textArea.val entry.get('message')
@edit()
@form.formErrors(response)
else
@view.model.set 'notification', ''
@trigger 'save', entry
##
# Callback when the model fails to save