From d5511ad8eeb17688d5d264ee8c4a51a0b49b3f91 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Fri, 7 Mar 2025 09:09:52 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E7=AB=99=E5=86=85=E4=BF=A1=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=8F=AF=E5=85=B3=E9=97=AD=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/v1/projects/pipelines_controller.rb | 14 ++++++++++++-- app/controllers/users_controller.rb | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/projects/pipelines_controller.rb b/app/controllers/api/v1/projects/pipelines_controller.rb index 68305a40b..9e20d9ffa 100644 --- a/app/controllers/api/v1/projects/pipelines_controller.rb +++ b/app/controllers/api/v1/projects/pipelines_controller.rb @@ -47,6 +47,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController interactor = sha.present? ? Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update").merge(sha: sha)) : Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("create")) tip_exception(interactor.error) unless interactor.success? file = interactor.result + @pipeline.save render_ok({ pipeline_yaml: pipeline_yaml, pipeline_name: params[:pipeline_name], file_name: @pipeline.file_name, sha: sha.present? ? sha : file['content']['sha'] }) end @@ -79,8 +80,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController def destroy @pipeline = Action::Pipeline.find(params[:id]) - if pipeline - interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update")) + if @pipeline + interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, del_content_params.merge(identifier: @project.identifier)) tip_exception(interactor.error) unless interactor.success? @pipeline.destroy! end @@ -172,6 +173,15 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController } end + def del_content_params(opt) + { + filepath: ".gitea/workflows/#{@pipeline.pipeline_name}.yml", + base64_filepath: Base64.encode64(".gitea/workflows/#{@pipeline.pipeline_name}.yml").gsub(/\n/, ''), + branch: @pipeline.branch, + sha: get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch) + } + end + def build_nodes(params_nodes) steps_nodes = [] params_nodes.each do |input_node| diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 761a88fa8..4c18cac4b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -263,7 +263,7 @@ class UsersController < ApplicationController begin @user = current_user begin - result = Notice::Read::CountService.call(current_user.id) + result = EduSetting.get("notice_disable").to_s == "true" ? nil : Notice::Read::CountService.call(current_user.id) @message_unread_total = result.nil? ? 0 : result[2]["unread_notification"] rescue @message_unread_total = 0