|
|
|
@ -3,7 +3,7 @@ class FilesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
before_action :require_login, except: %i[index]
|
|
|
|
|
before_action :find_course, except: %i[public_with_course_and_project mine_with_course_and_project]
|
|
|
|
|
before_action :find_ids, only: %i[bulk_delete bulk_send bulk_move bulk_public]
|
|
|
|
|
before_action :find_ids, only: %i[bulk_delete bulk_send bulk_move bulk_public bulk_publish]
|
|
|
|
|
before_action :file_validate_sort_type, only: :index
|
|
|
|
|
before_action :validate_send_message_to_course_params, only: :bulk_send
|
|
|
|
|
before_action :set_pagination, only: %i[index public_with_course_and_project mine_with_course_and_project]
|
|
|
|
@ -40,6 +40,12 @@ class FilesController < ApplicationController
|
|
|
|
|
@attachments = @attachments.page(@page).per(@page_size)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def bulk_publish
|
|
|
|
|
return normal_status(403, "您没有权限进行操作") if current_user.course_identity(@course) >= 5
|
|
|
|
|
@course.attachments.by_ids(@attachment_ids).unpublish.update_all(is_publish: 1, publish_time: Time.now)
|
|
|
|
|
render_ok
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def bulk_delete
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
begin
|
|
|
|
|