2017-08-17 22:00:37 +05:30
|
|
|
module Users
|
|
|
|
class ActivityService
|
|
|
|
def initialize(author, activity)
|
|
|
|
@author = author.respond_to?(:user) ? author.user : author
|
|
|
|
@activity = activity
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
return unless @author && @author.is_a?(User)
|
|
|
|
|
|
|
|
record_activity
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def record_activity
|
2018-03-17 18:26:18 +05:30
|
|
|
Gitlab::UserActivities.record(@author.id) if Gitlab::Database.read_write?
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
Rails.logger.debug("Recorded activity: #{@activity} for User ID: #{@author.id} (username: #{@author.username})")
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|