canvas-lms/app/models
Mark Ericksen 89ba5c1258 Remove user's avatar url when profile picture is deleted. Fixes #8225
When an file attachment is deleted, check to see if it is used as the user's
profile picture. If so, delete the avatar url that references the file.
Also adds an "active" named scope to Attachment that is used in FilesController
to not return image_thumbnails for deleted attachments.
Adds a User method "clear_avatar_image_url_with_uuid" and specs to test it.

Test Plan:
* Add a profile picture to a user.
* Verify that the image shows up on GradeBook2
* Delete the file used as the profile picture from the user's "Files" area.
* Revisit the GradeBook2 page and the user's profile image should be the
   default one used when none is assigned (silhouette).

Change-Id: Iaa0941a84503e341158615a12c62a77e951c283f
Reviewed-on: https://gerrit.instructure.com/10654
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-05-15 14:51:59 -06:00
..
discussion_topic use ids relative to the default shard for strands refs #6886 2012-04-02 09:47:09 -06:00
quiz_question score unknown question types as 0 / points_possible 2012-05-14 15:39:07 -06:00
abstract_course.rb make course terms sticky 2011-09-30 11:00:27 -06:00
access_token.rb implement oauth2 native app flow, closes #5029 2011-07-18 22:27:36 -06:00
account.rb Show term info when you show course name, fixes #6837 2012-05-01 13:04:49 -06:00
account_authorization_config.rb allow saml configurations to use the eppn 2012-04-30 16:26:09 -06:00
account_notification.rb fix account announcements across shards fixes #7396 2012-03-13 09:14:26 -06:00
account_report.rb remove the account.root_account || account idiom 2012-01-03 11:47:33 -07:00
account_user.rb temporary and deleted users have no account associations 2012-02-08 14:37:17 -07:00
alert.rb cache notifications in memory 2012-03-05 14:49:27 -07:00
alert_criterion.rb alerts, closes #4317 2011-08-24 10:19:44 -06:00
announcement.rb send announcement notifications to observers; fixes #7424 2012-03-14 14:26:14 -06:00
appointment_group.rb multiple contexts per appointment group 2012-04-30 15:30:03 -06:00
appointment_group_context.rb multiple contexts per appointment group 2012-04-30 15:30:03 -06:00
appointment_group_sub_context.rb multiple contexts per appointment group 2012-04-30 15:30:03 -06:00
assessment_question.rb correctly prepare quiz questions when copying course 2012-05-08 09:10:41 -06:00
assessment_question_bank.rb don't repeat questions when picking from banks, fixes #4212 2011-10-19 09:42:29 -06:00
assessment_question_bank_user.rb Initial commit. 2011-01-31 18:57:29 -07:00
assessment_request.rb i18n AssessmentRequest 2011-06-09 16:43:35 -06:00
asset_user_access.rb remove dead code around page views 2012-03-15 08:46:51 -06:00
assignment.rb Don't display locked assignments in "To Do" area. Fixes #6610 2012-05-11 14:35:36 -06:00
assignment_group.rb undelete course objects on course copy 2012-05-07 09:24:14 -06:00
assignment_reminder.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
attachment.rb Remove user's avatar url when profile picture is deleted. Fixes #8225 2012-05-15 14:51:59 -06:00
attachment_association.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
authorization_code.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
big_blue_button_conference.rb zero-pad the voiceBridge id 2011-08-10 14:33:34 -06:00
bookmark_service.rb i18n Bookmark Service 2011-06-16 07:16:10 -06:00
calendar_event.rb undelete course objects on course copy 2012-05-07 09:24:14 -06:00
cloned_item.rb make sure links in assessment questions are correctly translated, fixes #6012 2011-10-21 08:36:34 -06:00
collaboration.rb remove collaborations.yml dependency, refs #5796 2011-10-25 17:32:32 -06:00
collaborator.rb Initial commit. 2011-01-31 18:57:29 -07:00
collection.rb collections models and api 2012-05-10 13:38:58 -06:00
collection_item.rb collections models and api 2012-05-10 13:38:58 -06:00
collection_item_data.rb collections models and api 2012-05-10 13:38:58 -06:00
collection_item_upvote.rb collections models and api 2012-05-10 13:38:58 -06:00
communication_channel.rb use a meaningful context for confirmation notifications 2012-02-22 14:43:53 -07:00
content_export.rb fix immediate migration notifications 2012-05-11 13:59:26 -06:00
content_migration.rb copy attachments referenced in html content when copying course 2012-05-09 10:31:02 -06:00
content_tag.rb don't fail when copying/import invalid urls 2012-02-16 13:48:33 -07:00
context.rb clear out the wiki when resetting course content refs #4583 2011-08-24 12:37:04 -06:00
context_external_tool.rb prepare for foreign keys refs #6895 2012-05-10 09:46:05 -06:00
context_module.rb undelete course objects on course copy 2012-05-07 09:24:14 -06:00
context_module_progression.rb use kept_score for quizzes when evaluating module requirements 2011-08-11 10:01:39 -06:00
context_module_sub_header.rb optimize AdheresToPolicy 2011-07-14 13:25:28 -06:00
conversation.rb create media object if it doesn't exist, fixes #8420 2012-05-02 21:29:59 -06:00
conversation_message.rb ensure atom feeds have absolute urls and authors; fixes #7047 2012-04-09 09:02:56 -06:00
conversation_message_participant.rb ensure context tags are shared by 2+ participants, fixes #7231 2012-02-13 13:29:45 -07:00
conversation_participant.rb create media object if it doesn't exist, fixes #8420 2012-05-02 21:29:59 -06:00
course.rb make courses#workflow_state sis sticky fixes #8258 2012-05-10 14:00:38 -06:00
course_account_association.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
course_assigned_group.rb Initial commit. 2011-01-31 18:57:29 -07:00
course_import.rb make course copy have lower priority 2012-01-24 15:45:26 -07:00
course_section.rb fix calendar event linking issues, fixes #8337, #8338, #8339 2012-04-26 16:29:41 -06:00
delayed_message.rb cache notifications in memory 2012-03-05 14:49:27 -07:00
delayed_notification.rb notifications: allow including extra data for messages 2012-04-18 17:08:13 -06:00
designer_enrollment.rb straighten out course designer permissions 2012-01-13 18:56:50 -07:00
developer_key.rb always search for deprecated api key usage on the default shard 2012-04-02 09:07:13 -06:00
dim_dim_conference.rb wimba integration, fixes #2989 2011-02-25 14:35:14 -07:00
discussion_entry.rb prepare for foreign keys refs #6895 2012-05-10 09:46:05 -06:00
discussion_entry_participant.rb discussion topics materialized view api, refs #7567 2012-03-22 12:49:49 -06:00
discussion_topic.rb prepare for foreign keys refs #6895 2012-05-10 09:46:05 -06:00
discussion_topic_participant.rb read/unread state + counts for discussions; closes #7173 2012-02-24 13:34:54 -07:00
document_service.rb Initial commit. 2011-01-31 18:57:29 -07:00
enrollment.rb fix ungraded counts, fixes #7774 2012-05-08 16:26:05 -06:00
enrollment_dates_override.rb term start/term end, rather than whenever 2011-09-13 15:20:15 -06:00
enrollment_term.rb optimize UsersController#show a bit 2011-10-06 13:42:42 -06:00
eportfolio.rb account-level option to disable eportfolios, closes #5169 2011-08-24 17:38:06 -06:00
eportfolio_category.rb localize ePortfolios 2011-06-24 13:17:25 -06:00
eportfolio_entry.rb ensure atom feeds have absolute urls and authors; fixes #7047 2012-04-09 09:02:56 -06:00
error_report.rb more general (and slightly faster) fast distinct for postgres 2012-02-01 14:02:22 -07:00
etherpad_collaboration.rb remove collaborations.yml dependency, refs #5796 2011-10-25 17:32:32 -06:00
external_feed.rb replace usage of Date.today 2011-12-20 15:25:45 -07:00
external_feed_entry.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
external_url.rb optimize AdheresToPolicy 2011-07-14 13:25:28 -06:00
favorite.rb added favorite courses option to main menu 2011-10-24 15:50:34 -06:00
folder.rb save attachments before message creation, fixes #7229 2012-04-02 16:39:27 -06:00
google_docs_collaboration.rb Initial commit. 2011-01-31 18:57:29 -07:00
gradebook_upload.rb prepare for foreign keys refs #6895 2012-05-10 09:46:05 -06:00
grading_standard.rb undelete course objects on course copy 2012-05-07 09:24:14 -06:00
group.rb don't allow students to edit graded discussions, fixes: #7289 2012-05-03 13:59:57 -06:00
group_category.rb calendar and scheduler apis; refs #3395 2012-01-06 12:35:27 -07:00
group_membership.rb only send conference invitations to active members fixes #5290 2012-04-26 14:19:50 -06:00
hashtag.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
inbox_item.rb added states so we can retire messages w/o deleting them yet 2011-08-16 21:15:26 -06:00
learning_outcome.rb undelete course objects on course copy 2012-05-07 09:24:14 -06:00
learning_outcome_group.rb fix infinite recursion in outcome groups 2011-12-19 16:28:26 -07:00
learning_outcome_result.rb avoid several extra cases of saving learning outcome results 2011-05-31 13:10:33 -06:00
mailer.rb allow for configuration of outgoing email name 2011-07-21 13:33:16 -06:00
media_object.rb add Attachment#root_account_id 2012-02-01 14:01:52 -07:00
message.rb notifications: allow including extra data for messages 2012-04-18 17:08:13 -06:00
notification.rb force content migration emails to send immediately; fixes #8318 2012-05-03 10:35:49 -06:00
notification_policy.rb normalize user_id out of notification_policies 2012-02-01 12:42:23 -07:00
oauth_request.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
observer_enrollment.rb fix page error if observed is not an active student 2012-03-09 10:46:56 -07:00
open_object.rb Initial commit. 2011-01-31 18:57:29 -07:00
page_comment.rb localize PageComments 2011-06-17 08:28:33 -06:00
page_view.rb Order user's PageView list as CSV with most recent first. Fixes #7474 2012-05-09 16:19:52 -06:00
plugin_setting.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
pseudonym.rb prepare for foreign keys refs #6895 2012-05-10 09:46:05 -06:00
pseudonym_session.rb make "stay logged in" use a one-time token 2011-11-22 10:15:13 -07:00
quiz.rb copy published state for surveys/practice quizzes 2012-05-11 15:01:11 -06:00
quiz_group.rb correctly prepare quiz questions when copying course 2012-05-08 09:10:41 -06:00
quiz_question.rb correctly prepare quiz questions when copying course 2012-05-08 09:10:41 -06:00
quiz_submission.rb saved quiz attempts not auto-submitted at due time, fixes #7933 2012-05-14 09:20:05 -06:00
quiz_submission_snapshot.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
report_snapshot.rb refactor ReportSnapshot refs #7721 2012-03-30 09:17:43 -06:00
role_override.rb enable assignment properties to be locked 2012-04-27 10:41:41 -06:00
rubric.rb undelete course objects on course copy 2012-05-07 09:24:14 -06:00
rubric_assessment.rb Show freeform rubric comments to students, fixes #4864 2012-02-27 16:40:46 -07:00
rubric_association.rb Link new RubricAssociation to existing assessment_requests Fixes #7837 2012-05-08 16:45:34 -06:00
scribd_account.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
scribd_mime_type.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
session_persistence_token.rb make "stay logged in" use a one-time token 2011-11-22 10:15:13 -07:00
setting.rb conversations api, closes #4753 2011-09-13 09:28:57 -06:00
short_message.rb Initial commit. 2011-01-31 18:57:29 -07:00
short_message_association.rb optimize AdheresToPolicy 2011-07-14 13:25:28 -06:00
sis_batch.rb only perform batch sis removal for the types of data that were supplied 2012-05-08 09:46:49 -06:00
sis_batch_log_entry.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
stream_item.rb don't infer the current user for nil DiscussionTopic#user in the stream 2012-05-08 12:55:24 -06:00
stream_item_instance.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
student_enrollment.rb Minor fixes to StudentEnrollment associations. 2012-05-04 16:46:43 -06:00
student_view_enrollment.rb student view; closes #6995 2012-04-03 14:11:07 -06:00
submission.rb fixes for ruby 1.9.3 2012-05-12 14:34:23 -06:00
submission_comment.rb prepare for foreign keys refs #6895 2012-05-10 09:46:05 -06:00
submission_comment_participant.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
ta_enrollment.rb straighten out course designer permissions 2012-01-13 18:56:50 -07:00
tableless.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
teacher_enrollment.rb straighten out course designer permissions 2012-01-13 18:56:50 -07:00
thumbnail.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
user.rb Remove user's avatar url when profile picture is deleted. Fixes #8225 2012-05-15 14:51:59 -06:00
user_account_association.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
user_note.rb User notes from conversation messages; still needs UI 2011-07-31 16:09:03 -06:00
user_profile.rb fixes for ruby 1.9.3 2012-05-12 14:34:23 -06:00
user_service.rb fix user_service utc bug 2011-10-04 09:54:52 -06:00
web_conference.rb only send conference invitations to active members fixes #5290 2012-04-26 14:19:50 -06:00
web_conference_participant.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
wiki.rb string extraction for most i18n oddities 2011-06-30 16:48:12 -06:00
wiki_namespace.rb optimize AdheresToPolicy 2011-07-14 13:25:28 -06:00
wiki_page.rb don't fail content import with nil wiki page 2012-04-30 15:22:39 -06:00
wiki_page_comment.rb optimize AdheresToPolicy 2011-07-14 13:25:28 -06:00
wimba_conference.rb expose sortable name to user, fixes #5317 2011-10-31 12:22:08 -06:00
zip_file_import.rb use ids relative to the default shard for strands refs #6886 2012-04-02 09:47:09 -06:00