fixed 分支操作时项目时间更新

This commit is contained in:
xxq250 2025-05-30 09:32:31 +08:00
parent a3e156005f
commit 07f7394172
1 changed files with 4 additions and 0 deletions

View File

@ -36,11 +36,13 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
def create
@result_object = Api::V1::Projects::Branches::CreateService.call(@project, branch_params, current_user&.gitea_token)
@project.update_column(:updated_on, Time.now)
end
def destroy
@result_object = Api::V1::Projects::Branches::DeleteService.call(@project, params[:name], current_user&.gitea_token)
if @result_object
@project.update_column(:updated_on, Time.now)
# 有开启的pr需要一同关闭
# 1、删除本仓库中存在未关闭的pr,即本仓库分支1->分支2
# 2、如果是fork仓库考虑删除主仓库中存在未关闭的pr,即本仓库分支1->主分支2同时分两种删除1删除本仓库分支12删除主仓库分支2
@ -59,6 +61,7 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
def restore
@result_object = Api::V1::Projects::Branches::RestoreService.call(@project, params[:branch_id], params[:branch_name], current_user&.gitea_token)
if @result_object
@project.update_column(:updated_on, Time.now)
return render_ok
else
return render_error('恢复分支失败!')
@ -70,6 +73,7 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
def update_default_branch
@result_object = Api::V1::Projects::Branches::UpdateDefaultBranchService.call(@project, params[:name], current_user&.gitea_token)
if @result_object
@project.update_column(:updated_on, Time.now)
return render_ok
else
return render_error('更新默认分支失败!')