diff options
author | Brett Walker <bwalker@gitlab.com> | 2018-10-26 12:49:16 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-10-26 12:49:16 +0000 |
commit | 7aeab58f4861144fcc1d334907cb1b465c645001 (patch) | |
tree | cc37daf4788c2f7c3d951e3fdc3164e1b7ae0fd9 /app/services/boards | |
parent | 9791f82b4b4f873c153e6698fbb2148b8fa5babe (diff) | |
download | gitlab-ce-7aeab58f4861144fcc1d334907cb1b465c645001.tar.gz |
Automatically navigate to last board visited
Diffstat (limited to 'app/services/boards')
-rw-r--r-- | app/services/boards/visits/create_service.rb | 17 | ||||
-rw-r--r-- | app/services/boards/visits/latest_service.rb | 17 |
2 files changed, 34 insertions, 0 deletions
diff --git a/app/services/boards/visits/create_service.rb b/app/services/boards/visits/create_service.rb new file mode 100644 index 00000000000..e2adf755511 --- /dev/null +++ b/app/services/boards/visits/create_service.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Boards + module Visits + class CreateService < Boards::BaseService + def execute(board) + return unless current_user && Gitlab::Database.read_write? + + if parent.is_a?(Group) + BoardGroupRecentVisit.visited!(current_user, board) + else + BoardProjectRecentVisit.visited!(current_user, board) + end + end + end + end +end diff --git a/app/services/boards/visits/latest_service.rb b/app/services/boards/visits/latest_service.rb new file mode 100644 index 00000000000..9e4c77a6317 --- /dev/null +++ b/app/services/boards/visits/latest_service.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Boards + module Visits + class LatestService < Boards::BaseService + def execute + return nil unless current_user + + if parent.is_a?(Group) + BoardGroupRecentVisit.latest(current_user, parent) + else + BoardProjectRecentVisit.latest(current_user, parent) + end + end + end + end +end |