discourse/app/models
Blake Erickson 67dec38f31 FIX: Gravatar download attempt if user is missing their email
It is possible that a user could exist without an email, if so we should
not enqueue a job to download their gravatar.

This commit resolves this error that can occur:

```
Job exception: undefined method `email' for nil:NilClass
/var/www/discourse/app/models/user.rb:1204:in `email'
/var/www/discourse/app/jobs/regular/update_gravatar.rb:12:in `execute'
```

This commit also fixes the original spec which actually was wrong. The
job never enqueued in the original spec and so the gravatar was never
actually updated and the test was checking if the two values were the
same, but they were both null and never updated, so of course they were
the same!

A new test has also been added to make sure the gravatar job isn't
enqueued when a user's email is missing.
2020-09-02 20:19:46 -06:00
..
concerns Accounted for the change while reading the fields added specs to confirm working 2020-08-25 09:52:18 -04:00
reports FIX: Use include-subcategories filter in report export (#10007) 2020-06-10 18:57:39 +03:00
about.rb PERF: speed up about page render time and limit category mods (#8112) 2019-10-03 21:48:56 +03:00
admin_dashboard_data.rb DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
admin_dashboard_general_data.rb FIX: Allow dashboard to load even when git version cannot be found 2019-08-28 12:37:42 +01:00
admin_dashboard_index_data.rb
allowed_pm_user.rb FEATURE: Allow List for PMs (#10270) 2020-07-20 15:23:49 -06:00
anonymous_user.rb
api_key.rb FEATURE: Add scopes to API keys (#9844) 2020-07-16 15:51:24 -03:00
api_key_scope.rb FEATURE: More API scopes (#10493) 2020-08-24 12:15:08 -03:00
application_request.rb Revert "Revert "Merge branch 'master' of https://github.com/discourse/discourse"" 2020-05-23 00:56:13 -04:00
auto_track_duration_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
backup_draft_post.rb FEATURE: experimental hidden setting for draft backups 2019-10-17 16:58:21 +11:00
backup_draft_topic.rb FEATURE: experimental hidden setting for draft backups 2019-10-17 16:58:21 +11:00
backup_file.rb
backup_location_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
backup_metadata.rb FEATURE: Drop "backup" schema 7 days after restore 2020-01-16 17:48:47 +01:00
badge.rb FIX: Unassign user titles when a badge is deleted (#9573) 2020-05-02 18:02:28 -07:00
badge_grouping.rb
badge_type.rb
base_font_setting.rb FEATURE: Add site setting and wizard step to set base font (#10250) 2020-08-31 13:14:09 +03:00
bookmark.rb FIX: Rename delete_when_reminder_sent? bookmark method to avoid conflict with AR (#10333) 2020-07-29 17:02:36 +10:00
category.rb FIX: Reindex posts when `Topic#title` or `Category#name` changes. 2020-07-17 11:12:31 +08:00
category_and_topic_lists.rb
category_custom_field.rb
category_featured_topic.rb FIX: Use Discourse.system_user when we need a placeholder admin (#9781) 2020-06-24 15:51:30 +10:00
category_group.rb PERF: Add index on group to category_groups (#8231) 2019-10-23 10:30:43 +01:00
category_list.rb DEV: Refactor draft attributes for `CategoryList` and `TopicList`. 2020-07-24 10:11:30 +08:00
category_page_style.rb
category_search_data.rb
category_tag.rb
category_tag_group.rb
category_tag_stat.rb
category_user.rb FEATURE: add `regular_categories` field in site setting & user option. (#10477) 2020-08-20 00:35:04 +05:30
child_theme.rb
color_scheme.rb Update annotations. 2020-09-01 13:41:04 +05:30
color_scheme_color.rb FIX: Wizard could not send custom color schemes to the client correctly (#10484) 2020-08-20 17:10:33 -07:00
color_scheme_setting.rb Add site setting to pick dark mode color scheme (#10390) 2020-08-07 08:52:47 -04:00
custom_emoji.rb DEV: annotate models 2020-04-28 15:59:39 +05:30
developer.rb DEV: Update annotations 2019-11-29 15:49:08 +00:00
digest_email_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
directory_item.rb FEATURE: Display "Last Updated At" on user directory 2020-03-30 14:34:48 -04:00
discourse_single_sign_on.rb FEATURE: support SSO website and location overrides 2020-04-28 16:06:35 +10:00
discourse_version_check.rb
draft.rb FIX: properly ban non human users from draft system 2020-05-26 10:07:09 +10:00
draft_sequence.rb FIX: properly ban non human users from draft system 2020-05-26 10:07:09 +10:00
draftable_list.rb DEV: Refactor draft attributes for `CategoryList` and `TopicList`. 2020-07-24 10:11:30 +08:00
email_change_request.rb DEV: annotate models 2020-07-22 16:02:31 +05:30
email_level_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
email_log.rb FIX: Allow users to add emails which were deleted before 2020-06-11 14:54:11 +03:00
email_style.rb FIX: backwards compatibility for uncompiled email style css 2019-10-23 19:22:33 -04:00
email_token.rb
embeddable_host.rb DEV: Update annotations. 2020-08-21 11:36:53 +08:00
embedding.rb FIX: use allowlist and blocklist terminology (#10209) 2020-07-27 10:23:54 +10:00
emoji.rb FIX: allows to have custom emoji translation without static file (#9893) 2020-05-27 20:11:52 +02:00
emoji_set_site_setting.rb
github_user_info.rb
given_daily_like.rb
global_setting.rb FIX: use allowlist and blocklist terminology (#10209) 2020-07-27 10:23:54 +10:00
group.rb FIX: System message wasn't fully translatable 2020-09-02 15:24:25 +02:00
group_archived_message.rb FEATURE: Implement support for IMAP and SMTP email protocols. (#8301) 2020-07-10 12:05:55 +03:00
group_category_notification_default.rb FEATURE: set notification levels when added to a group (#10378) 2020-08-06 12:27:27 -04:00
group_custom_field.rb
group_history.rb
group_manager.rb
group_mention.rb
group_request.rb
group_tag_notification_default.rb FEATURE: set notification levels when added to a group (#10378) 2020-08-06 12:27:27 -04:00
group_user.rb FEATURE: allow group membership to unmute categories and tags 2020-08-13 17:20:53 -04:00
ignored_user.rb
imap_sync_log.rb DEV: IMAP log to database (#10435) 2020-08-14 12:01:31 +10:00
incoming_domain.rb
incoming_email.rb FIX: IMAP sync email update uniqueness across groups and minor improvements (#10332) 2020-08-03 13:10:17 +10:00
incoming_link.rb DEV: pluck_first 2019-10-21 12:08:20 +01:00
incoming_links_report.rb FEATURE: Make report filters reusable (#9444) 2020-04-22 11:52:50 +03:00
incoming_referer.rb
invite.rb FIX: 'resend all invite' button was not working as expected 2020-07-08 15:52:44 +05:30
invite_redeemer.rb FIX: check for inviter group permissions at the time of redeeming invite 2020-06-15 14:44:35 +05:30
invited_group.rb
invited_user.rb FEATURE: multiple use invite links (#9813) 2020-06-09 20:49:32 +05:30
javascript_cache.rb FIX: theme-javascripts using incorrect subfolder setting 2020-03-17 19:09:06 -07:00
like_notification_frequency_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
locale_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
mailing_list_mode_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
muted_user.rb
new_topic_duration_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
notification.rb DEV: adds event_reminder (27) and event_invitation (28) (#10473) 2020-08-19 12:07:51 +02:00
notification_level_when_replying_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
oauth2_user_info.rb FIX: allow storage of non unique rows in oauth2_user_infos 2019-10-25 11:57:34 +11:00
onceoff_log.rb
optimized_image.rb DEV: Add timestamp columns to optimized_images table (#10199) 2020-07-14 11:50:33 +01:00
permalink.rb DEV: Deprecate Category#url_with_id in favor of Category#url (#9972) 2020-06-18 11:32:14 +03:00
plugin_store.rb
plugin_store_row.rb
post.rb DEV: Replace SECURE_MEDIA_ROUTE const with other methods (#10545) 2020-08-28 11:28:11 +10:00
post_action.rb FIX: Stop updating bookmarked column from TopicUser.update_post_action_cache (#10188) 2020-07-08 15:27:42 +10:00
post_action_type.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
post_analyzer.rb FIX - limit number of embedded media items in a post (#10391) 2020-08-07 12:08:59 -04:00
post_custom_field.rb
post_detail.rb
post_mover.rb FIX: generate topic excerpt when moving posts to new topic. 2020-08-13 11:30:14 +05:30
post_reply.rb DEV: Standardize ignored_columns removal comments (#9771) 2020-05-13 13:08:15 -07:00
post_reply_key.rb
post_revision.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
post_search_data.rb Remove out-of-date / non-core annotations. 2020-09-01 12:40:57 +05:30
post_stat.rb
post_timing.rb FIX: We don't want to update the post read count and user stats if the post timing wasn't created due to a conflict. (#8824) 2020-01-31 10:23:24 -03:00
post_upload.rb
previous_replies_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
published_page.rb FEATURE: allows published pages to be public (#10053) 2020-06-17 12:42:20 +02:00
push_subscription.rb
quoted_post.rb FEATURE: Nokogumbo (#9577) 2020-05-05 13:46:57 +10:00
remote_theme.rb FEATURE: option to update child theme components via theme CLI. 2020-03-27 03:41:56 +05:30
remove_muted_tags_from_latest_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
report.rb FIX: Use include-subcategories filter in report export (#10007) 2020-06-10 18:57:39 +03:00
reviewable.rb Update annotations. 2020-09-01 13:41:04 +05:30
reviewable_claimed_topic.rb FIX: Don't log a claimed topic database error during tests 2020-01-09 12:32:05 -05:00
reviewable_flagged_post.rb Update annotations. 2020-09-01 13:41:04 +05:30
reviewable_history.rb FEATURE: Add logging when claiming and unclaiming reviewable flagged posts (#8920) 2020-02-10 15:40:01 -08:00
reviewable_priority_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
reviewable_queued_post.rb Update annotations. 2020-09-01 13:41:04 +05:30
reviewable_score.rb DEV: Plugins can extend ReviewableScore types. (#10156) 2020-07-02 11:47:43 -03:00
reviewable_sensitivity_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
reviewable_user.rb Update annotations. 2020-09-01 13:41:04 +05:30
s3_region_site_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
screened_email.rb FEATURE: when blocking emails prefer blocking canonical 2020-04-24 14:09:51 +10:00
screened_ip_address.rb FIX: use allowlist and blocklist terminology (#10209) 2020-07-27 10:23:54 +10:00
screened_url.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
search_log.rb DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
shared_draft.rb
single_sign_on_record.rb
site.rb DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
site_setting.rb FEATURE: Dark mode alternative logos (#10441) 2020-08-17 15:43:20 -04:00
skipped_email_log.rb FIX: don't send digests to users with no primary email 2020-05-27 17:09:40 +02:00
slug_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
stylesheet_cache.rb FIX: Don't raise error when adding to cache fails in readonly mode. 2020-07-21 12:20:23 +08:00
tag.rb FIX: delete unused tags shouldn't delete tags belonging to tag groups 2020-08-19 12:17:49 -04:00
tag_group.rb FIX: remove parent tag from tag group 2020-03-13 12:25:58 -04:00
tag_group_membership.rb
tag_group_permission.rb
tag_search_data.rb
tag_user.rb FEATURE: set notification levels when added to a group (#10378) 2020-08-06 12:27:27 -04:00
theme.rb FIX: Invalidate database theme cache when hostname changes (#9908) 2020-05-29 13:04:51 +01:00
theme_field.rb DEV: Let themes extend color definitions (#10429) 2020-08-18 13:02:13 -04:00
theme_modifier_set.rb DEV: annotate models 2020-05-27 19:05:24 +05:30
theme_setting.rb FEATURE: add support for `upload` format in theme settings. 2020-04-15 18:34:02 +05:30
theme_translation_override.rb
top_lists.rb
top_menu_item.rb
top_topic.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
topic.rb FIX: Ensure autoclose based on last post is executed by system user. 2020-08-26 12:08:46 +08:00
topic_allowed_group.rb
topic_allowed_user.rb
topic_converter.rb FIX: Limit personal message participants when converting from topic (#9343) 2020-04-03 16:42:01 +01:00
topic_custom_field.rb Annotate models. 2020-09-01 10:22:32 +05:30
topic_embed.rb Rename options passed to Readability::Document back to whitelist and blacklist (#10340) 2020-07-30 12:56:48 -07:00
topic_featured_users.rb
topic_group.rb Changed `CONFLICT` to `SQL` for multiline strings 2019-12-13 11:51:40 -05:00
topic_invite.rb
topic_link.rb FIX: identify slug-less topic urls everywhere 2020-06-29 12:31:20 +02:00
topic_link_click.rb FIX: use allowlist and blocklist terminology (#10209) 2020-07-27 10:23:54 +10:00
topic_list.rb DEV: Refactor draft attributes for `CategoryList` and `TopicList`. 2020-07-24 10:11:30 +08:00
topic_notifier.rb
topic_participants_summary.rb PERF: Combine avatar_lookup and primary_group_lookup into user_lookup (#10253) 2020-07-17 10:48:08 +01:00
topic_poster.rb
topic_posters_summary.rb PERF: Combine avatar_lookup and primary_group_lookup into user_lookup (#10253) 2020-07-17 10:48:08 +01:00
topic_search_data.rb
topic_tag.rb
topic_thumbnail.rb DEV: followup to prev commit 2020-05-26 16:19:05 +10:00
topic_timer.rb Minor follow-up bug fix for 5ff6c10. 2020-08-26 17:25:28 +08:00
topic_tracking_state.rb FEATURE: include tags in unread/new messages 2020-06-12 16:20:30 +10:00
topic_user.rb FIX: Stop updating bookmarked column from TopicUser.update_post_action_cache (#10188) 2020-07-08 15:27:42 +10:00
topic_view_item.rb FIX: exclude private messages from TL3 requirements 2020-04-07 17:36:07 -04:00
translation_override.rb FIX: use allowlist and blocklist terminology (#10209) 2020-07-27 10:23:54 +10:00
trust_level3_requirements.rb PERF: Faster TL3 promotion replies needed calculation (#10416) 2020-08-12 11:28:34 -03:00
trust_level_and_staff_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
trust_level_setting.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
unsubscribe_key.rb
upload.rb DEV: Replace SECURE_MEDIA_ROUTE const with other methods (#10545) 2020-08-28 11:28:11 +10:00
user.rb FIX: Gravatar download attempt if user is missing their email 2020-09-02 20:19:46 -06:00
user_action.rb FIX: UserAction did not have a types enum (#10553) 2020-08-28 11:49:19 -07:00
user_api_key.rb DEV: Drop 'key' column from user_api_keys (#9388) 2020-04-22 12:13:19 +03:00
user_archived_message.rb
user_associated_account.rb
user_auth_token.rb FEATURE: Limit the number of active sessions for a user (#8411) 2019-11-27 12:39:31 +00:00
user_auth_token_log.rb
user_avatar.rb Revert "Revert "Merge branch 'master' of https://github.com/discourse/discourse"" 2020-05-23 00:56:13 -04:00
user_badge.rb DEV: annotate models 2020-04-28 15:59:39 +05:30
user_badges.rb
user_bookmark_list.rb Get rid of named param double reference in UserBookmarkList 2020-04-01 15:04:04 +10:00
user_custom_field.rb Remove out-of-date / non-core annotations. 2020-09-01 12:40:57 +05:30
user_email.rb FIX: : trigger `user_updated` event only if email changed after user creation. 2020-07-16 18:21:30 +05:30
user_export.rb REVERT: DEV: should ignore missing post uploads when a user export destroyed 2019-07-25 19:41:25 +05:30
user_field.rb
user_field_option.rb
user_history.rb FEATURE: Create logs for Group Moderator changes (#10271) 2020-07-21 14:29:02 -04:00
user_open_id.rb DEV: Drop legacy OpenID 2.0 support (#8894) 2020-02-07 17:32:35 +00:00
user_option.rb Update annotations. 2020-09-01 13:41:04 +05:30
user_profile.rb FIX: use allowlist and blocklist terminology (#10209) 2020-07-27 10:23:54 +10:00
user_profile_view.rb DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
user_search.rb SECURITY: Check permissions when autocompleting mentions 2019-10-28 11:01:47 +00:00
user_search_data.rb
user_second_factor.rb SECURITY: Improve second factor auth logic 2020-01-10 10:45:56 +10:00
user_security_key.rb DEV: annotate models 2019-10-17 16:58:22 +11:00
user_stat.rb PERF: Faster TL3 promotion replies needed calculation (#10416) 2020-08-12 11:28:34 -03:00
user_summary.rb PERF: Combine avatar_lookup and primary_group_lookup into user_lookup (#10253) 2020-07-17 10:48:08 +01:00
user_upload.rb
user_visit.rb
user_warning.rb
username_validator.rb FIX: use allowlist and blocklist terminology (#10209) 2020-07-27 10:23:54 +10:00
watched_word.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
web_crawler_request.rb DEV: s/\$redis/Discourse\.redis (#8431) 2019-12-03 10:05:53 +01:00
web_hook.rb DEV: Remove code deprecated by the new Reviewable API (#8023) 2019-08-26 10:33:26 -03:00
web_hook_event.rb
web_hook_event_type.rb Revert "Revert "Merge branch 'master' of https://github.com/discourse/discourse"" 2020-05-23 00:56:13 -04:00