2016-10-05 10:41:32 -04:00
|
|
|
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
|
2017-03-07 13:34:43 -05:00
|
|
|
Gitlab::UserActivities.record(@author.id)
|
2016-10-05 10:41:32 -04:00
|
|
|
|
2017-06-04 02:11:53 -04:00
|
|
|
Rails.logger.debug("Recorded activity: #{@activity} for User ID: #{@author.id} (username: #{@author.username})")
|
2016-10-05 10:41:32 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|