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

Create `shared_user_list_optional` filter strategy

Aaron Contrerasf804b9c5f94c
diff --git a/app/models/queries/filters.rb b/app/models/queries/filters.rb
index 24f48b54cc3..4a909226ac3 100644
--- a/app/models/queries/filters.rb
+++ b/app/models/queries/filters.rb
@@ -31,6 +31,7 @@ module Queries::Filters
list: Queries::Filters::Strategies::List,
list_all: Queries::Filters::Strategies::ListAll,
list_optional: Queries::Filters::Strategies::ListOptional,
+ shared_user_list_optional: Queries::Filters::Strategies::WorkPackages::SharedUser::ListOptional,
integer: Queries::Filters::Strategies::Integer,
date: Queries::Filters::Strategies::Date,
datetime_past: Queries::Filters::Strategies::DateTimePast,
diff --git a/app/models/queries/filters/strategies/work_packages/shared_user/list_optional.rb b/app/models/queries/filters/strategies/work_packages/shared_user/list_optional.rb
new file mode 100644
index 00000000000..4eb2674da0e
--- /dev/null
+++ b/app/models/queries/filters/strategies/work_packages/shared_user/list_optional.rb
@@ -0,0 +1,43 @@
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2010-2023 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.
+# ++
+
+module Queries::Filters::Strategies
+ module WorkPackages
+ module SharedUser
+ class ListOptional < ::Queries::Filters::Strategies::ListOptional
+ def operator_map
+ super.dup.tap do |super_value|
+ super_value['='] = ::Queries::Operators::Equals
+ super_value['*'] = ::Queries::Operators::WorkPackages::SharedUser::Any
+ super_value['!*'] = ::Queries::Operators::WorkPackages::SharedUser::None
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/app/models/queries/operators/work_packages/shared_user/any.rb b/app/models/queries/operators/work_packages/shared_user/any.rb
new file mode 100644
index 00000000000..a9a41f82755
--- /dev/null
+++ b/app/models/queries/operators/work_packages/shared_user/any.rb
@@ -0,0 +1,37 @@
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2010-2023 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.
+# ++
+
+module Queries::Operators
+ module WorkPackages
+ module SharedUser
+ class Any < ::Queries::Operators::All
+ label 'operator_shared_user_any'
+ end
+ end
+ end
+end
diff --git a/app/models/queries/operators/work_packages/shared_user/none.rb b/app/models/queries/operators/work_packages/shared_user/none.rb
new file mode 100644
index 00000000000..7178fdf247b
--- /dev/null
+++ b/app/models/queries/operators/work_packages/shared_user/none.rb
@@ -0,0 +1,37 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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.
+#++
+
+module Queries::Operators
+ module WorkPackages
+ module SharedUser
+ class None < ::Queries::Operators::None
+ label 'operator_shared_user_none'
+ end
+ end
+ end
+end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 1c5cd3feeb6..edd999f810d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1953,6 +1953,8 @@ en:
label_operator_none: "is empty"
label_operator_equals_or: "is (OR)"
label_operator_equals_all: "is (AND)"
+ label_operator_shared_user_any: "any"
+ label_operator_shared_user_none: "none"
label_open_menu: "Open menu"
label_open_work_packages: "open"
label_open_work_packages_plural: "open"