mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Revert "[STC-356] Disallow setting journal aggregation period to >2 hours"
This reverts commit 75de0dbcd2.
This commit is contained in:
@@ -1,47 +0,0 @@
|
|||||||
# 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.
|
|
||||||
#++
|
|
||||||
|
|
||||||
module Settings
|
|
||||||
class UpdateParamsContract < ::ParamsContract
|
|
||||||
validate :journal_aggregation_time_minutes_is_within_bounds
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def journal_aggregation_time_minutes_is_within_bounds
|
|
||||||
value = params[:journal_aggregation_time_minutes]
|
|
||||||
return if value.nil?
|
|
||||||
|
|
||||||
allowed = Settings::Definition[:journal_aggregation_time_minutes].allowed
|
|
||||||
unless allowed.cover?(value.to_i)
|
|
||||||
errors.add(:journal_aggregation_time_minutes, :inclusion)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -34,11 +34,9 @@ module Admin
|
|||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
settings_form do |f|
|
settings_form do |f|
|
||||||
allowed = ::Settings::Definition[:journal_aggregation_time_minutes].allowed
|
|
||||||
f.text_field name: :journal_aggregation_time_minutes,
|
f.text_field name: :journal_aggregation_time_minutes,
|
||||||
type: :number,
|
type: :number,
|
||||||
min: allowed.min,
|
min: 0,
|
||||||
max: allowed.max,
|
|
||||||
input_width: :medium,
|
input_width: :medium,
|
||||||
trailing_visual: { text: { text: I18n.t("datetime.units.minute_abbreviated", count: 2) } }
|
trailing_visual: { text: { text: I18n.t("datetime.units.minute_abbreviated", count: 2) } }
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -1,9 +1,5 @@
|
|||||||
<%= render(Primer::Beta::Text.new(tag: :p)) do %>
|
<%= render(Primer::Beta::Text.new(tag: :p)) do %>
|
||||||
<%= link_translate(
|
<%= link_translate("admin.journal_aggregation.caption", links: { webhook_link: url_helpers.admin_outgoing_webhooks_path }) %>
|
||||||
"admin.journal_aggregation.caption",
|
|
||||||
i18n_args: { max: ::Settings::Definition[:journal_aggregation_time_minutes].allowed.max },
|
|
||||||
links: { webhook_link: url_helpers.admin_outgoing_webhooks_path }
|
|
||||||
) %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= render(Primer::OpenProject::InlineMessage.new(scheme: :warning, size: :small)) do %>
|
<%= render(Primer::OpenProject::InlineMessage.new(scheme: :warning, size: :small)) do %>
|
||||||
<%= render(Primer::Beta::Text.new(tag: :p)) do %>
|
<%= render(Primer::Beta::Text.new(tag: :p)) do %>
|
||||||
|
|||||||
@@ -34,13 +34,6 @@ class Settings::UpdateService < BaseServices::BaseContracted
|
|||||||
contract_class: Settings::UpdateContract)
|
contract_class: Settings::UpdateContract)
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_params
|
|
||||||
contract = Settings::UpdateParamsContract.new(model, user, params:)
|
|
||||||
ServiceResult.new success: contract.valid?,
|
|
||||||
errors: contract.errors,
|
|
||||||
result: model
|
|
||||||
end
|
|
||||||
|
|
||||||
def persist(call)
|
def persist(call)
|
||||||
params.each do |name, value|
|
params.each do |name, value|
|
||||||
set_setting_value(name, value)
|
set_setting_value(name, value)
|
||||||
|
|||||||
@@ -697,8 +697,7 @@ module Settings
|
|||||||
default: 7
|
default: 7
|
||||||
},
|
},
|
||||||
journal_aggregation_time_minutes: {
|
journal_aggregation_time_minutes: {
|
||||||
default: 5,
|
default: 5
|
||||||
allowed: 0..120
|
|
||||||
},
|
},
|
||||||
ldap_force_no_page: {
|
ldap_force_no_page: {
|
||||||
description: "Force LDAP to respond as a single page, in case paged responses do not work with your server.",
|
description: "Force LDAP to respond as a single page, in case paged responses do not work with your server.",
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ en:
|
|||||||
jemalloc_allocator: Jemalloc memory allocator
|
jemalloc_allocator: Jemalloc memory allocator
|
||||||
journal_aggregation:
|
journal_aggregation:
|
||||||
caption: >
|
caption: >
|
||||||
User actions on a work package (changing description, status, values, or writing comments) are grouped if performed within this period. It also controls notification and [webhook](webhook_link) delays. The maximum is %{max} minutes.
|
User actions on a work package (changing description, status, values, or writing comments) are grouped if performed within this period. It also controls notification and [webhook](webhook_link) delays.
|
||||||
import:
|
import:
|
||||||
title: "Import"
|
title: "Import"
|
||||||
jira:
|
jira:
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
# 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.
|
|
||||||
#++
|
|
||||||
|
|
||||||
require "spec_helper"
|
|
||||||
require "contracts/shared/model_contract_shared_context"
|
|
||||||
|
|
||||||
RSpec.describe Settings::UpdateParamsContract do
|
|
||||||
include_context "ModelContract shared context"
|
|
||||||
|
|
||||||
let(:current_user) { build_stubbed(:admin) }
|
|
||||||
let(:contract) do
|
|
||||||
described_class.new(nil, current_user, params:)
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "journal_aggregation_time_minutes validation" do
|
|
||||||
[0, 5, 120].each do |valid_value|
|
|
||||||
context "with value #{valid_value}" do
|
|
||||||
let(:params) { { journal_aggregation_time_minutes: valid_value.to_s } }
|
|
||||||
|
|
||||||
it_behaves_like "contract is valid"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
[121, 9_999_999, -1].each do |invalid_value|
|
|
||||||
context "with value #{invalid_value}" do
|
|
||||||
let(:params) { { journal_aggregation_time_minutes: invalid_value.to_s } }
|
|
||||||
|
|
||||||
it_behaves_like "contract is invalid", journal_aggregation_time_minutes: :inclusion
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when not present in params" do
|
|
||||||
let(:params) { {} }
|
|
||||||
|
|
||||||
it_behaves_like "contract is valid"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user