更改:webhook历史记录部分字段编码级

This commit is contained in:
yystopf 2023-04-13 20:17:47 +08:00
parent 16dbb87526
commit 8ac7b6a7e7
3 changed files with 10 additions and 3 deletions

View File

@ -451,7 +451,7 @@ class Project < ApplicationRecord
Jbuilder.new do |project|
project.id self.id
project.identifier self.identifier
project.name self.name.to_s.each_char.select { |c| c.bytes.first < 240 }.join('')
project.name self.name
project.description Nokogiri::HTML(self.description).text
project.visits self.visits
project.praises_count self.praises_count.to_i
@ -475,7 +475,7 @@ class Project < ApplicationRecord
project.image_url render_educoder_avatar_url(self.project_educoder)
else
user = self.owner
project.name user.try(:show_real_name).to_s.each_char.select { |c| c.bytes.first < 240 }.join('')
project.name user.try(:show_real_name)
project.type user&.type
project.login user.login
project.image_url user.get_letter_avatar_url

View File

@ -862,7 +862,7 @@ class User < Owner
def to_builder
Jbuilder.new do |user|
user.(self, :id, :login)
user.name self.real_name.to_s.each_char.select { |c| c.bytes.first < 240 }.join('')
user.name self.real_name
user.email self.mail
user.image_url self.get_letter_avatar_url
end

View File

@ -0,0 +1,7 @@
class ChangeWebhookTaskFieldCharacter < ActiveRecord::Migration[5.2]
def change
Gitea::Base.connection.execute("ALTER TABLE `hook_task` MODIFY `payload_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;")
Gitea::Base.connection.execute("ALTER TABLE `hook_task` MODIFY `request_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;")
Gitea::Base.connection.execute("ALTER TABLE `hook_task` MODIFY `response_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;")
end
end