From 7b12145ed904e531fa4e573cb5efb50abdedf6ac Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 21 Sep 2015 21:13:06 +0000 Subject: [PATCH] Raises wiki edits comments limit to 1024 (#19886). git-svn-id: http://svn.redmine.org/redmine/trunk@14622 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/wiki_content.rb | 2 +- app/views/wiki/edit.html.erb | 2 +- ...243_change_wiki_contents_comments_limit_to_1024.rb | 11 +++++++++++ test/functional/wiki_controller_test.rb | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20150921210243_change_wiki_contents_comments_limit_to_1024.rb diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb index 992c7da34..223b6ca47 100644 --- a/app/models/wiki_content.rb +++ b/app/models/wiki_content.rb @@ -22,7 +22,7 @@ class WikiContent < ActiveRecord::Base belongs_to :page, :class_name => 'WikiPage' belongs_to :author, :class_name => 'User' validates_presence_of :text - validates_length_of :comments, :maximum => 255, :allow_nil => true + validates_length_of :comments, :maximum => 1024, :allow_nil => true attr_protected :id acts_as_versioned diff --git a/app/views/wiki/edit.html.erb b/app/views/wiki/edit.html.erb index 2a2ba312a..566e96029 100644 --- a/app/views/wiki/edit.html.erb +++ b/app/views/wiki/edit.html.erb @@ -29,7 +29,7 @@ <% end %> <% end %> -

<%= f.text_field :comments, :size => 120 %>

+

<%= f.text_field :comments, :size => 120, :maxlength => 1024 %>

<%= render :partial => 'attachments/form' %>

diff --git a/db/migrate/20150921210243_change_wiki_contents_comments_limit_to_1024.rb b/db/migrate/20150921210243_change_wiki_contents_comments_limit_to_1024.rb new file mode 100644 index 000000000..5a35b03a1 --- /dev/null +++ b/db/migrate/20150921210243_change_wiki_contents_comments_limit_to_1024.rb @@ -0,0 +1,11 @@ +class ChangeWikiContentsCommentsLimitTo1024 < ActiveRecord::Migration + def self.up + change_column :wiki_content_versions, :comments, :string, :limit => 1024, :default => '' + change_column :wiki_contents, :comments, :string, :limit => 1024, :default => '' + end + + def self.down + change_column :wiki_content_versions, :comments, :string, :limit => 255, :default => '' + change_column :wiki_contents, :comments, :string, :limit => 255, :default => '' + end +end diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 9bffe66c7..5471fcf21 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -319,7 +319,7 @@ class WikiControllerTest < ActionController::TestCase put :update, :project_id => 1, :id => 'Another_page', :content => { - :comments => 'a' * 300, # failure here, comment is too long + :comments => 'a' * 1300, # failure here, comment is too long :text => 'edited' }, :wiki_page => { -- 2.39.5