Module: RecordUserLastActivity

Extended by:
ActiveSupport::Concern
Includes:
CookiesHelper
Included in:
Dashboard::ApplicationController, Groups::BoardsController, GroupsController, Projects::IssuesController, Projects::MergeRequestsController, ProjectsController
Defined in:
app/controllers/concerns/record_user_last_activity.rb

Overview

RecordUserLastActivity

Controller concern that updates the `last_activity_on` field of `users` for any authenticated GET request. The DB update will only happen once per day.

In order to determine if you should include this concern or not, please check the description and discussion on this issue: gitlab.com/gitlab-org/gitlab-foss/issues/54947

Constant Summary

Constants included from CookiesHelper

CookiesHelper::COOKIE_TYPE_ENCRYPTED, CookiesHelper::COOKIE_TYPE_PERMANENT

Instance Method Summary collapse

Methods included from CookiesHelper

#set_secure_cookie

Instance Method Details

#set_user_last_activityObject


18
19
20
21
22
23
24
25
# File 'app/controllers/concerns/record_user_last_activity.rb', line 18

def set_user_last_activity
  return unless request.get?
  return if Gitlab::Database.read_only?

  if current_user && current_user.last_activity_on != Date.today
    Users::ActivityService.new(current_user).execute
  end
end