Browse Source

fix: commit author and fork create units

tags/v3.0.2
vilet.yy 5 years ago
parent
commit
c175fa1339
2 changed files with 4 additions and 2 deletions
  1. +2
    -0
      app/services/projects/fork_service.rb
  2. +2
    -2
      app/views/pull_requests/_commit.json.jbuilder

+ 2
- 0
app/services/projects/fork_service.rb View File

@@ -24,6 +24,8 @@ class Projects::ForkService < ApplicationService
new_repository.identifier = @project.identifier
new_repository.save!

ProjectUnit.init_types(clone_project.id)

result = Gitea::Repository::ForkService.new(@project.owner, @target_owner, @project.identifier, @organization).call

@project.update_column('forked_count', @project&.forked_count.to_i + 1)


+ 2
- 2
app/views/pull_requests/_commit.json.jbuilder View File

@@ -1,11 +1,11 @@
json.author do
author = User.find_by(login: commit['Author']['Name'])
json.partial! 'repositories/commit_author', locals: { user: author }
json.partial! 'repositories/commit_author', locals: { user: author, name: commit['Committer']['Name'] }
end

json.committer do
author = User.find_by(login: commit['Committer']['Name'])
json.partial! 'repositories/commit_author', locals: { user: author }
json.partial! 'repositories/commit_author', locals: { user: author, name: commit['Committer']['Name'] }
end
json.timestamp render_unix_time(commit['Committer']['When'])
json.time_from_now time_from_now(commit['Committer']['When'])


Loading…
Cancel
Save