Skip to content

Commit

Permalink
fixed the notifier toast from always showing in progress in the patch… (
Browse files Browse the repository at this point in the history
#4903)

Co-authored-by: github username <github email address>
  • Loading branch information
jamgar authored Jun 23, 2023
1 parent a4c0fdb commit e13e7b0
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
34 changes: 23 additions & 11 deletions app/javascript/src/all_casa_admin/patch_notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ const patchNoteFunctions = {} // A hack to be able to alphabetize functions

let pageNotifier

jQuery.ajaxSetup({
beforeSend: function () {
pageNotifier.startAsyncOperation()
}
})

// Inserts a patch note display after the create patch note form in the patch note list and styles it as new
// @param {number} patchNoteGroupId The id of the group allowed to view the patch note
// @param {jQuery} patchNoteList A jQuery object representing the patch note list
Expand Down Expand Up @@ -69,10 +63,22 @@ patchNoteFunctions.createPatchNote = function (patchNoteGroupId, patchNoteText,
TypeChecker.checkString(patchNoteText, 'patchNoteText')

// Post request
return $.post(patchNotePath, {
note: patchNoteText,
patch_note_group_id: patchNoteGroupId,
patch_note_type_id: patchNoteTypeId
// return $.post(patchNotePath, {
// note: patchNoteText,
// patch_note_group_id: patchNoteGroupId,
// patch_note_type_id: patchNoteTypeId
// })
return $.ajax({
url: patchNotePath,
type: 'POST',
data: {
note: patchNoteText,
patch_note_group_id: patchNoteGroupId,
patch_note_type_id: patchNoteTypeId
},
beforeSend: function () {
pageNotifier.startAsyncOperation()
}
})
.then(function (response, textStatus, jqXHR) {
if (response.errors) {
Expand Down Expand Up @@ -100,7 +106,10 @@ patchNoteFunctions.deletePatchNote = function (patchNoteId) {

return $.ajax({
url: `${patchNotePath}/${patchNoteId}`,
type: 'DELETE'
type: 'DELETE',
beforeSend: function () {
pageNotifier.startAsyncOperation()
}
})
.then(function (response, textStatus, jqXHR) {
if (response.errors) {
Expand Down Expand Up @@ -464,6 +473,9 @@ patchNoteFunctions.savePatchNote = function (patchNoteGroupId, patchNoteId, patc
note: patchNoteText,
patch_note_group_id: patchNoteGroupId,
patch_note_type_id: patchNoteTypeId
},
beforeSend: function () {
pageNotifier.startAsyncOperation()
}
})
.then(function (response, textStatus, jqXHR) {
Expand Down
1 change: 1 addition & 0 deletions app/models/casa_admin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def change_to_supervisor!
# old_emails :string default([]), is an Array
# phone_number :string default("")
# receive_email_notifications :boolean default(TRUE)
# receive_reimbursement_email :boolean default(FALSE)
# receive_sms_notifications :boolean default(FALSE), not null
# reset_password_sent_at :datetime
# reset_password_token :string
Expand Down
1 change: 1 addition & 0 deletions app/models/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def recently_unassigned_volunteers
# old_emails :string default([]), is an Array
# phone_number :string default("")
# receive_email_notifications :boolean default(TRUE)
# receive_reimbursement_email :boolean default(FALSE)
# receive_sms_notifications :boolean default(FALSE), not null
# reset_password_sent_at :datetime
# reset_password_token :string
Expand Down
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def normalize_phone_number
# old_emails :string default([]), is an Array
# phone_number :string default("")
# receive_email_notifications :boolean default(TRUE)
# receive_reimbursement_email :boolean default(FALSE)
# receive_sms_notifications :boolean default(FALSE), not null
# reset_password_sent_at :datetime
# reset_password_token :string
Expand Down
1 change: 1 addition & 0 deletions app/models/volunteer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def cases_where_contact_made_in_days(num_days = CONTACT_MADE_IN_DAYS_NUM)
# old_emails :string default([]), is an Array
# phone_number :string default("")
# receive_email_notifications :boolean default(TRUE)
# receive_reimbursement_email :boolean default(FALSE)
# receive_sms_notifications :boolean default(FALSE), not null
# reset_password_sent_at :datetime
# reset_password_token :string
Expand Down
1 change: 1 addition & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.string "old_emails", default: [], array: true
t.boolean "receive_reimbursement_email", default: false
t.index ["casa_org_id"], name: "index_users_on_casa_org_id"
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
t.index ["email"], name: "index_users_on_email", unique: true
Expand Down

0 comments on commit e13e7b0

Please sign in to comment.