21 lines
524 B
Ruby
Raw Permalink Normal View History

2024-12-07 17:30:25 +01:00
# frozen_string_literal: true
module ::DiscourseRewind
class RewindsController < ::ApplicationController
requires_plugin PLUGIN_NAME
2025-01-13 18:17:02 +01:00
requires_login
2024-12-07 17:30:25 +01:00
def show
2025-01-20 16:50:51 +01:00
DiscourseRewind::FetchReports.call(service_params) do
2025-01-13 17:00:32 +01:00
on_model_not_found(:year) { raise Discourse::NotFound }
on_model_not_found(:user) { raise Discourse::NotFound }
2024-12-07 18:40:23 +01:00
on_success do |reports:|
@reports = reports
2024-12-13 17:00:17 +01:00
render json: MultiJson.dump(reports), status: 200
2024-12-07 18:40:23 +01:00
end
end
2024-12-07 17:30:25 +01:00
end
end
end