fixed CloudIDEA文件标记已读未读列表
This commit is contained in:
parent
99850e45ad
commit
2b31b683dd
|
@ -5,16 +5,17 @@ class MarkFilesController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@files_result = Gitea::PullRequest::FilesService.call(@owner.login, @project.identifier, @pull_request.gitea_number, current_user&.gitea_token)
|
@files_result = Gitea::PullRequest::FilesService.call(@owner.login, @project.identifier, @pull_request.gitea_number, current_user&.gitea_token)
|
||||||
|
|
||||||
MarkFile.bulk_insert(*%i[pull_request_id, file_path_sha file_path created_at updated_at]) do |worker|
|
|
||||||
@files_result['Files'].echo do |file|
|
|
||||||
worker.add(pull_request_id: @pull_request.id, file_path_sha: SecureRandom.uuid.gsub("-", ""), file_path: file['Name'])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@mark_files = MarkFile.where(pull_request_id: @pull_request.id)
|
@mark_files = MarkFile.where(pull_request_id: @pull_request.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
unless @pull_request.mark_files.present?
|
||||||
|
MarkFile.bulk_insert(*%i[pull_request_id, file_path_sha file_path created_at updated_at]) do |worker|
|
||||||
|
@files_result['Files'].each do |file|
|
||||||
|
worker.add(pull_request_id: @pull_request.id, file_path_sha: SecureRandom.uuid.gsub("-", ""), file_path: file['Name'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
json.status 0
|
json.status 0
|
||||||
json.message 'success'
|
json.message 'success'
|
||||||
json.count @mark_files.count
|
json.count @files_result['NumFiles']
|
||||||
json.files do
|
json.files do
|
||||||
json.array! @mark_files do |file|
|
json.array! @files_result do |file|
|
||||||
json.sha file.file_path_sha
|
mark_file = @mark_files.select{|mark| mark.file_path.to_s == file['Name']}.first
|
||||||
json.name file.file_path
|
json.sha Base64.encode64(file.file['Name'].to_s)
|
||||||
json.mark_as_read file.mark_as_read
|
json.name file.file['Name']
|
||||||
json.updated_after_read file.updated_after_read
|
json.mark_as_read mark_file.present? ? mark_file.mark_as_read : false
|
||||||
|
# json.updated_after_read mark_file.present? ? mark_file.updated_after_read : false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue