OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add scope for autologged/non_autologged
Oliver Günthera17dfbbc3c73
diff --git a/app/controllers/my/sessions_controller.rb b/app/controllers/my/sessions_controller.rbindex 19b6eefd21a..69aff7bcbff 100644--- a/app/controllers/my/sessions_controller.rb+++ b/app/controllers/my/sessions_controller.rb@@ -50,8 +50,8 @@ module My@unmapped_sessions = ::Sessions::UserSession.for_user(current_user)+ .not_autologged.order(updated_at: :desc)- .where.not(id: ::Sessions::AutologinSessionLink.where(token_id: @autologin_tokens.select(:id)).select(:session_id))token = cookies[OpenProject::Configuration["autologin_cookie_name"]]if tokendiff --git a/app/models/sessions/user_session.rb b/app/models/sessions/user_session.rbindex 0f81c8d3029..a74fe3fb703 100644--- a/app/models/sessions/user_session.rb+++ b/app/models/sessions/user_session.rb@@ -47,6 +47,14 @@ module Sessionswhere(user_id: nil)end+ scope :autologged, -> do+ where(id: ::Sessions::AutologinSessionLink.select(:session_id))+ end++ scope :not_autologged, -> do+ where.not(id: ::Sessions::AutologinSessionLink.select(:session_id))+ end+### Mark all records as readonly so they cannot# modify the database