2021-04-03 00:53:34 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-12-07 17:30:25 +01:00
|
|
|
# name: discourse-rewind
|
2025-11-07 10:20:25 +10:00
|
|
|
# about: A fun end-of-year summary for members' activity in the community.
|
|
|
|
|
# meta_topic_id: https://meta.discourse.org/t/discourse-rewind-2024/348063
|
2021-04-03 00:53:34 +02:00
|
|
|
# version: 0.0.1
|
|
|
|
|
# authors: Discourse
|
2025-11-07 10:20:25 +10:00
|
|
|
# url: https://github.com/discourse/discourse-rewind
|
2021-06-22 11:00:35 +02:00
|
|
|
# required_version: 2.7.0
|
2021-04-03 00:53:34 +02:00
|
|
|
|
2024-12-07 17:30:25 +01:00
|
|
|
enabled_site_setting :discourse_rewind_enabled
|
2021-04-03 00:53:34 +02:00
|
|
|
|
2024-12-13 17:00:17 +01:00
|
|
|
register_svg_icon "repeat"
|
|
|
|
|
|
2025-01-13 13:46:41 +01:00
|
|
|
register_asset "stylesheets/common/_index.scss"
|
|
|
|
|
register_asset "stylesheets/mobile/_index.scss", :mobile
|
2024-12-13 17:00:17 +01:00
|
|
|
|
2024-12-07 17:30:25 +01:00
|
|
|
module ::DiscourseRewind
|
|
|
|
|
PLUGIN_NAME = "discourse-rewind"
|
|
|
|
|
|
|
|
|
|
def self.public_asset_path(name)
|
|
|
|
|
File.expand_path(File.join(__dir__, "public", name))
|
|
|
|
|
end
|
2023-02-24 13:00:01 +00:00
|
|
|
end
|
|
|
|
|
|
2024-12-07 17:30:25 +01:00
|
|
|
require_relative "lib/discourse_rewind/engine"
|
2023-02-24 13:00:01 +00:00
|
|
|
|
2025-11-07 10:20:25 +10:00
|
|
|
after_initialize do
|
|
|
|
|
add_to_serializer(:current_user, :is_rewind_active) do
|
2025-11-18 09:03:41 -05:00
|
|
|
Rails.env.development? || Date.today.month == 1 || Date.today.month == 12
|
2025-11-07 10:20:25 +10:00
|
|
|
end
|
2025-11-18 09:03:41 -05:00
|
|
|
|
|
|
|
|
add_to_serializer(:current_user, :is_development_env) { Rails.env.development? }
|
2025-11-07 10:20:25 +10:00
|
|
|
end
|