diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index e21c087bf..ee0b5efff 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -109,7 +109,7 @@ class IssuesController < ApplicationController def create issue_params = issue_send_params(params) - Issues::CreateForm.new(issue_params.slice(:subject, :description)).validate! + Issues::CreateForm.new({subject: issue_params[:subject], description: issue_params[:description].b}).validate! @issue = Issue.new(issue_params) if @issue.save! SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, @issue&.id) if Site.has_notice_menu? @@ -223,7 +223,7 @@ class IssuesController < ApplicationController normal_status(-1, "不允许修改为关闭状态") else issue_params = issue_send_params(params).except(:issue_classify, :author_id, :project_id) - Issues::UpdateForm.new(issue_params.slice(:subject, :description)).validate! + Issues::UpdateForm.new({subject: issue_params[:subject], description: issue_params[:description].b}).validate! if @issue.update_attributes(issue_params) if @issue&.pull_request.present? SendTemplateMessageJob.perform_later('PullRequestChanged', current_user.id, @issue&.pull_request&.id, @issue.previous_changes.slice(:assigned_to_id, :priority_id, :fixed_version_id, :issue_tags_value)) if Site.has_notice_menu? diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 2dd1fef69..7c0676590 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -23,7 +23,7 @@ class JournalsController < ApplicationController normal_status(-1, "评论内容不能为空") else ActiveRecord::Base.transaction do - Journals::CreateForm.new({notes: notes.to_s.strip}).validate! + Journals::CreateForm.new({notes: notes.to_s.strip.b}).validate! journal_params = { journalized_id: @issue.id , journalized_type: "Issue", @@ -75,7 +75,7 @@ class JournalsController < ApplicationController def update content = params[:content] if content.present? - Journals::UpdateForm.new({notes: notes.to_s.strip}).validate! + Journals::UpdateForm.new({notes: notes.to_s.strip.b}).validate! if @journal.update_attribute(:notes, content) normal_status(0, "更新成功") else diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index bb0407845..bf5646a4e 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -58,7 +58,7 @@ class PullRequestsController < ApplicationController def create # return normal_status(-1, "您不是目标分支开发者,没有权限,请联系目标分支作者.") unless @project.operator?(current_user) ActiveRecord::Base.transaction do - Issues::CreateForm.new({subject: params[:title], description: params}).validate! + Issues::CreateForm.new({subject: params[:title], description: params[:body].b}).validate! @pull_request, @gitea_pull_request = PullRequests::CreateService.call(current_user, @owner, @project, params) if @gitea_pull_request[:status] == :success @pull_request.bind_gitea_pull_request!(@gitea_pull_request[:body]["number"], @gitea_pull_request[:body]["id"]) @@ -90,7 +90,7 @@ class PullRequestsController < ApplicationController else ActiveRecord::Base.transaction do begin - Issues::UpdateForm.new({subject: params[:title], description: params[:body]}).validate! + Issues::UpdateForm.new({subject: params[:title], description: params[:body].b}).validate! merge_params @issue&.issue_tags_relates&.destroy_all if params[:issue_tag_ids].blank? diff --git a/app/models/journal.rb b/app/models/journal.rb index a1834ae2a..5bf05b0d2 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -6,7 +6,7 @@ # journalized_id :integer default("0"), not null # journalized_type :string(30) default(""), not null # user_id :integer default("0"), not null -# notes :text(65535) +# notes :text(4294967295) # created_on :datetime not null # private_notes :boolean default("0"), not null # parent_id :integer diff --git a/app/models/pull_request.rb b/app/models/pull_request.rb index 74111ad0d..a9f215c8d 100644 --- a/app/models/pull_request.rb +++ b/app/models/pull_request.rb @@ -3,8 +3,8 @@ # Table name: pull_requests # # id :integer not null, primary key -# pull_request_id :integer -# gpid :integer +# gitea_id :integer +# gitea_number :integer # user_id :integer # created_at :datetime not null # updated_at :datetime not null @@ -12,7 +12,7 @@ # project_id :integer # title :string(255) # milestone :integer -# body :text(65535) +# body :text(4294967295) # head :string(255) # base :string(255) # issue_id :integer diff --git a/db/migrate/20220506083813_change_issues_description_and_journals_notes_column.rb b/db/migrate/20220506083813_change_issues_description_and_journals_notes_column.rb new file mode 100644 index 000000000..a8b934c7d --- /dev/null +++ b/db/migrate/20220506083813_change_issues_description_and_journals_notes_column.rb @@ -0,0 +1,7 @@ +class ChangeIssuesDescriptionAndJournalsNotesColumn < ActiveRecord::Migration[5.2] + def change + change_column :issues, :description, :text, :limit => 4294967295 + change_column :journals, :notes, :text, :limit => 4294967295 + change_column :pull_requests, :body, :text, :limit => 4294967295 + end +end