修改:自定义事件

This commit is contained in:
2023-04-06 19:19:54 +08:00
parent 769c8a0194
commit cd489d3b97
10 changed files with 208 additions and 279 deletions

View File

@@ -117,4 +117,18 @@ class PullRequest < ApplicationRecord
JSON.parse file_names
end
def to_builder
Jbuilder.new do |pull|
pull.(self, :id, :gitea_number, :title, :body, :base, :head, :is_original, :comments_count)
pull.created_at self.created_at.strftime("%Y-%m-%d %H:%M")
pull.updated_at self.updated_at.strftime("%Y-%m-%d %H:%M")
pull.user self.user.to_builder
if self.fork_project.present?
pull.fork_project self.fork_project.to_builder
else
pull.fork_project nil
end
end
end
end