fixed 站内信设置可关闭开关

This commit is contained in:
xxq250 2025-03-07 09:09:52 +08:00
parent a2ad254510
commit d5511ad8ee
2 changed files with 13 additions and 3 deletions

View File

@ -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|

View File

@ -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