2023-10-11 19:43:20 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-10-17 18:02:55 +08:00
|
|
|
class ActivityNotification < BaseNotification
|
|
|
|
include SearchHelper
|
|
|
|
include GlobalActivitiesHelper
|
|
|
|
include InputSanitizeHelper
|
|
|
|
include ActionView::Helpers::TextHelper
|
|
|
|
include ApplicationHelper
|
|
|
|
include ActiveRecord::Sanitization::ClassMethods
|
|
|
|
include Rails.application.routes.url_helpers
|
2023-10-11 19:43:20 +08:00
|
|
|
|
|
|
|
def message
|
2023-10-17 18:02:55 +08:00
|
|
|
params[:message] if params[:legacy]
|
2023-10-11 19:43:20 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def title
|
2023-10-17 18:02:55 +08:00
|
|
|
if params[:legacy]
|
|
|
|
params[:title]
|
|
|
|
else
|
|
|
|
generate_activity_content(activity)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def subject
|
|
|
|
activity.subject unless params[:legacy]
|
2023-10-11 19:43:20 +08:00
|
|
|
end
|
2023-10-17 18:02:55 +08:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def current_team
|
|
|
|
@current_team ||= recipient.teams.find_by(id: recipient.current_team_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def current_user
|
|
|
|
recipient
|
|
|
|
end
|
|
|
|
|
|
|
|
def activity
|
|
|
|
@activity ||= Activity.find_by(id: params[:activity_id])
|
|
|
|
end
|
2023-10-11 19:43:20 +08:00
|
|
|
end
|