discourse/app/jobs/scheduled
David Taylor d0243f741e
UX: Use dominant color as image loading placeholder (#18248)
We previously had a system which would generate a 10x10px preview of images and add their URLs in a data-small-upload attribute. The client would then use that as the background-image of the `<img>` element. This works reasonably well on fast connections, but on slower connections it can take a few seconds for the placeholders to appear. The act of loading the placeholders can also break or delay the loading of the 'real' images.

This commit replaces the placeholder logic with a new approach. Instead of a 10x10px preview, we use imagemagick to calculate the average color of an image and store it in the database. The hex color value then added as a `data-dominant-color` attribute on the `<img>` element, and the client can use this as a `background-color` on the element while the real image is loading. That means no extra HTTP request is required, and so the placeholder color can appear instantly.

Dominant color will be calculated:
1. When a new upload is created
2. During a post rebake, if the dominant color is missing from an upload, it will be calculated and stored
3. Every 15 minutes, 25 old upload records are fetched and their dominant color calculated and stored. (part of the existing PeriodicalUpdates job)

Existing posts will continue to use the old 10x10px placeholder system until they are next rebaked
2022-09-20 10:28:17 +01:00
..
about_stats.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
activation_reminder_emails.rb DEV: Update :critical_user_email calls to use strings (#15827) 2022-02-04 23:43:53 +00:00
auto_expire_user_api_keys.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
auto_queue_handler.rb FEATURE: Blocking is optional when deleting a user from the review queue. (#13375) 2021-06-15 12:35:45 -03:00
badge_grant.rb FIX: Cached badge_count isn't updated after backfilling badges (#11281) 2020-11-18 22:01:56 +01:00
bookmark_reminder_notifications.rb FEATURE: Polymorphic bookmarks pt. 3 (reminders, imports, exports, refactors) (#16591) 2022-05-09 09:37:23 +10:00
category_stats.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
check_new_features.rb DEV: Prevents rate limits for new feature checks on multisite (#12053) 2021-02-12 08:52:59 -05:00
check_out_of_date_themes.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
clean_dismissed_topic_users.rb FIX: Dismiss new with better migration (#12062) 2021-02-15 08:50:33 +11:00
clean_up_associated_accounts.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
clean_up_associated_groups.rb FEATURE: Experimental support for group membership via google auth (#14835) 2021-12-09 12:30:27 +00:00
clean_up_crawler_stats.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
clean_up_email_change_requests.rb DEV: Periodically delete old email change requests (#13054) 2021-05-14 10:34:56 +03:00
clean_up_email_logs.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
clean_up_email_tokens.rb FIX: Delete unconfirmed AND expired email tokens only (#15089) 2021-11-25 10:34:30 +02:00
clean_up_exports.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
clean_up_inactive_users.rb FIX: Don't error CleanUpInactiveUserJob when user is missing (#8362) 2019-11-18 16:14:15 +11:00
clean_up_post_reply_keys.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
clean_up_search_logs.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
clean_up_stylesheet_cache.rb PERF: Add scheduled job to delete old stylesheet cache rows (#13747) 2021-07-16 10:58:01 -04:00
clean_up_unmatched_emails.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
clean_up_unmatched_ips.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
clean_up_unsubscribe_keys.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
clean_up_unused_api_keys.rb FEATURE: Overhaul of admin API key system (#8284) 2019-11-05 14:10:23 +00:00
clean_up_unused_staged_users.rb FEATURE: Add site setting to disable staged user cleanup 2020-03-09 10:26:41 +01:00
clean_up_uploads.rb FEATURE: Create upload_references table (#16146) 2022-06-09 09:24:30 +10:00
cleanup_imap_sync_log.rb DEV: IMAP log to database (#10435) 2020-08-14 12:01:31 +10:00
create_missing_avatars.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
create_recent_post_search_indexes.rb Fix the build. 2020-08-27 13:50:07 +08:00
dashboard_stats.rb FEATURE: remove duplicated messages about new advices (#14319) 2021-09-15 08:59:25 +10:00
destroy_old_deletion_stubs.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
destroy_old_hidden_posts.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
directory_refresh_daily.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
directory_refresh_older.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
disable_bootstrap_mode.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
drop_backup_schema.rb FEATURE: Drop "backup" schema 7 days after restore 2020-01-16 17:48:47 +01:00
enqueue_digest_emails.rb DEV: Use strings for :user_email job type argument 2022-02-04 18:28:18 +00:00
enqueue_onceoffs.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
enqueue_suspect_users.rb FIX: Reduce the time_read threshold to one minute. (#12159) 2021-02-20 08:25:32 -03:00
ensure_db_consistency.rb DEV: Fix typo 2020-10-07 23:43:11 +02:00
ensure_s3_uploads_existence.rb FIX: Prevent "uploads are missing in S3" alerts after restoring a backup 2020-09-10 21:37:48 +02:00
fix_user_usernames_and_groups_names_clash.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
grant_anniversary_badges.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
grant_new_user_of_the_month_badges.rb DEV: Require scheduled job in development to avoid loading file twice. 2020-09-01 10:14:40 +08:00
heartbeat.rb FIX: Zeitwerk-related fixes for jobs. (#8187) 2019-10-14 13:03:22 +03:00
ignored_users_summary.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
invalidate_inactive_admins.rb FEATURE: Add message to log when admins are automatically deactivated 2020-01-28 12:16:24 +00:00
migrate_upload_scheme.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
old_keys_reminder.rb DEV: Upgrade to Rails 7 2022-04-28 11:51:03 +02:00
pending_queued_posts_reminder.rb DEV: Convert notify_about_queued_posts_after to accept a float (#16637) 2022-05-04 11:33:43 -05:00
pending_reviewables_reminder.rb DEV: Convert notify_about_flags_after to float (#16633) 2022-05-04 11:19:43 -05:00
pending_users_reminder.rb FEATURE: Staff can receive pending user reminders more frequently. (#13422) 2021-06-24 10:02:56 -03:00
periodical_updates.rb UX: Use dominant color as image loading placeholder (#18248) 2022-09-20 10:28:17 +01:00
poll_mailbox.rb FIX: POP3 polling shouldn't stop after exception or old email (#12742) 2021-04-19 10:27:29 +02:00
presence_channel_auto_leave.rb DEV: Introduce PresenceChannel API for core and plugin use 2021-08-27 16:26:06 +01:00
problem_checks.rb FEATURE: Scheduled problem checks for admin dashboard (#15327) 2021-12-20 09:59:11 +10:00
process_badge_backlog.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
process_shelved_notifications.rb DEV: Replace 'processed' column on notifications with new table (#11864) 2021-01-27 10:29:24 -06:00
process_user_notification_schedules.rb DEV: Improve logging of errors in Jobs::ProcessUserNotificationSchedules 2021-07-21 12:20:44 +08:00
purge_deleted_uploads.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
purge_expired_ignored_users.rb DEV: Cleanup ignored user logic (#11107) 2020-11-03 12:38:54 +00:00
purge_old_web_hook_events.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
purge_unactivated.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
regenerate_sitemaps.rb FEATURE: Let sites add a sitemap.xml file. (#16357) 2022-04-12 10:33:59 -03:00
reindex_search.rb FIX: reindex_search job should work on model with no search data (#11819) 2021-01-25 11:23:36 +01:00
reviewable_priorities.rb FIX: Recalculate scores only when approving or transitioning to pending. (#13009) 2021-05-10 14:09:04 -03:00
schedule_backup.rb DEV: Add option to send system message to groups (#12256) 2021-03-02 18:51:50 +01:00
tl3_promotions.rb PERF: Dematerialize topic_reply_count (#9769) 2020-05-14 15:42:00 -07:00
top_refresh_older.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
top_refresh_today.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
topic_timer_enqueuer.rb FIX: Do not prevent other topic timers running on error (#13665) 2021-07-08 12:49:58 +10:00
unsilence_users.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
update_animated_uploads.rb FIX: Ensure old uploads can have animated field updated (#10963) 2020-10-20 19:11:43 +03:00
update_heat_settings.rb DEV: Upgrading Discourse to Zeitwerk (#8098) 2019-10-02 14:01:53 +10:00
version_check.rb DEV: Remove new_version_emails global setting reference 2019-11-20 15:54:09 +00:00
weekly.rb FEATURE: Add weekly bookmark cleanup code (#10899) 2020-10-14 09:38:57 +10:00