Skip to content

Commit

Permalink
Merge pull request #18000 from opf/task/61607-allow-more-characters-f…
Browse files Browse the repository at this point in the history
…or-time-entry-comment

Task/61607 allow more characters for time entry comment
  • Loading branch information
klaustopher authored Feb 19, 2025
2 parents 8132028 + 6088309 commit 01d4fc8
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/costs/app/components/time_entries/comments_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
module TimeEntries
class CommentsForm < ApplicationForm
form do |f|
f.text_area name: :comments, label: TimeEntry.human_attribute_name(:comments), maxlength: 255
f.text_area name: :comments, label: TimeEntry.human_attribute_name(:comments), maxlength: 1_000
end
end
end
2 changes: 1 addition & 1 deletion modules/costs/app/models/time_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TimeEntry < ApplicationRecord
allow_nil: true

validates :comments,
length: { maximum: 255 },
length: { maximum: 1_000 },
allow_blank: true

validates :start_time,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down Expand Up @@ -26,8 +28,8 @@
# See COPYRIGHT and LICENSE files for more details.
#++

require Rails.root.to_s + "/db/migrate/migration_utils/module_renamer"
require Rails.root.to_s + "/db/migrate/migration_utils/setting_renamer"
require Rails.root.join("db/migrate/migration_utils/module_renamer").to_s
require Rails.root.join("db/migrate/migration_utils/setting_renamer").to_s

class RenameTimeAndCostModule < ActiveRecord::Migration[6.0]
def up
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# 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 AddOngoingToTimeEntry < ActiveRecord::Migration[7.0]
def change
change_table :time_entries do |t|
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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 MakeTimeEntryCommentTextField < ActiveRecord::Migration[7.1]
def up
change_column :time_entries, :comments, :text
change_column :time_entry_journals, :comments, :text
end
end
8 changes: 4 additions & 4 deletions modules/costs/spec/models/time_entry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,13 @@ def ensure_membership(project, user, permissions)
expect(time_entry).to be_valid
end

it "allows values with a length of 255 characters" do
time_entry.comments = "a" * 255
it "allows values with a length of 1000 characters" do
time_entry.comments = "a" * 1000
expect(time_entry).to be_valid
end

it "does not allow values with a length of >255 characters" do
time_entry.comments = "a" * 256
it "does not allow values with a length of >1000 characters" do
time_entry.comments = "a" * 1001
expect(time_entry).not_to be_valid
end
end
Expand Down

0 comments on commit 01d4fc8

Please sign in to comment.