discourse-rewind/plugin.rb
Martin Brennan a600db4d06
FIX: Rename Favorite Tags/Categories to Most Viewed Tags/Categories and isRewindActive fixes (#27)
This was confusing people last year, most people assumed it meant
the tags they used the most / categories they posted in the most.
This should clear things up.

Also removes the `isRewindActive` function in favour of
`is_rewind_active`
on the current user, since then we only have one place to check this,
and
it makes testing easier since we don't have to mock browser time.

Finally it moves the route for rewind in the UI to the new route path
format.
2025-11-07 10:20:25 +10:00

33 lines
857 B
Ruby

# frozen_string_literal: true
# name: discourse-rewind
# 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
# version: 0.0.1
# authors: Discourse
# url: https://github.com/discourse/discourse-rewind
# required_version: 2.7.0
enabled_site_setting :discourse_rewind_enabled
register_svg_icon "repeat"
register_asset "stylesheets/common/_index.scss"
register_asset "stylesheets/mobile/_index.scss", :mobile
module ::DiscourseRewind
PLUGIN_NAME = "discourse-rewind"
def self.public_asset_path(name)
File.expand_path(File.join(__dir__, "public", name))
end
end
require_relative "lib/discourse_rewind/engine"
after_initialize do
add_to_serializer(:current_user, :is_rewind_active) do
Date.today.month == 1 || Date.today.month == 12
end
end