Skip to content

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

Allow using updated_at in project filters, selects and orders

Jan Sandbrink735d7b873826
diff --git a/app/components/projects/projects_filters_component.rb b/app/components/projects/projects_filters_component.rb
index 35b284cd572..2d563bfc164 100644
--- a/app/components/projects/projects_filters_component.rb
+++ b/app/components/projects/projects_filters_component.rb
@@ -59,7 +59,8 @@ class Projects::ProjectsFiltersComponent < Filter::FilterComponent
Queries::Projects::Filters::ProjectStatusFilter,
Queries::Projects::Filters::PublicFilter,
Queries::Projects::Filters::TemplatedFilter,
- Queries::Projects::Filters::TypeFilter
+ Queries::Projects::Filters::TypeFilter,
+ Queries::Projects::Filters::UpdatedAtFilter
]
allowlist.any? { |clazz| filter.is_a? clazz }
diff --git a/app/components/projects/row_component.rb b/app/components/projects/row_component.rb
index 4fe26d5335c..e95ad68eb36 100644
--- a/app/components/projects/row_component.rb
+++ b/app/components/projects/row_component.rb
@@ -116,6 +116,10 @@ module Projects
helpers.format_date(project.latest_activity_at)
end
+ def updated_at
+ helpers.format_date(project.updated_at)
+ end
+
def required_disk_space
return "" unless project.required_disk_space.to_i > 0
diff --git a/app/models/queries/projects.rb b/app/models/queries/projects.rb
index 93ba0f9cffd..0a92fbdd018 100644
--- a/app/models/queries/projects.rb
+++ b/app/models/queries/projects.rb
@@ -52,6 +52,7 @@ module Queries::Projects
filter Filters::TemplatedFilter
filter Filters::TypeFilter
filter Filters::TypeaheadFilter
+ filter Filters::UpdatedAtFilter
filter Filters::UserActionFilter
filter Filters::VisibleFilter
@@ -63,6 +64,7 @@ module Queries::Projects
order Orders::ProjectStatusOrder
order Orders::RequiredDiskSpaceOrder
order Orders::TypeaheadOrder
+ order Orders::UpdatedAtOrder
select Selects::CreatedAt
select Selects::CustomField
@@ -72,5 +74,6 @@ module Queries::Projects
select Selects::ProjectPhase
select Selects::RequiredDiskSpace
select Selects::Status
+ select Selects::UpdatedAt
end
end
diff --git a/app/models/queries/projects/filters/updated_at_filter.rb b/app/models/queries/projects/filters/updated_at_filter.rb
new file mode 100644
index 00000000000..413a53ca535
--- /dev/null
+++ b/app/models/queries/projects/filters/updated_at_filter.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+class Queries::Projects::Filters::UpdatedAtFilter < Queries::Projects::Filters::Base
+ def type
+ :datetime_past
+ end
+end
diff --git a/app/models/queries/projects/orders/updated_at_order.rb b/app/models/queries/projects/orders/updated_at_order.rb
new file mode 100644
index 00000000000..c9e8ecae564
--- /dev/null
+++ b/app/models/queries/projects/orders/updated_at_order.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+class Queries::Projects::Orders::UpdatedAtOrder < Queries::Orders::Base
+ self.model = Project
+
+ def self.key
+ :updated_at
+ end
+end
diff --git a/app/models/queries/projects/selects/updated_at.rb b/app/models/queries/projects/selects/updated_at.rb
new file mode 100644
index 00000000000..48e9dff7ec4
--- /dev/null
+++ b/app/models/queries/projects/selects/updated_at.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+# ++
+
+class Queries::Projects::Selects::UpdatedAt < Queries::Selects::Base
+ def self.key
+ :updated_at
+ end
+end
diff --git a/spec/models/queries/projects/project_query_spec.rb b/spec/models/queries/projects/project_query_spec.rb
index 54ec11ad873..5d723e0c700 100644
--- a/spec/models/queries/projects/project_query_spec.rb
+++ b/spec/models/queries/projects/project_query_spec.rb
@@ -149,6 +149,7 @@ RSpec.describe ProjectQuery do
budget_planned
budget_spent
budget_spent_ratio
+ updated_at
])
end
end
@@ -177,6 +178,7 @@ RSpec.describe ProjectQuery do
budget_planned
budget_spent
budget_spent_ratio
+ updated_at
])
end
end