Hook Request #1355

This commit is contained in:
Karel Pičman 2022-05-17 13:53:58 +02:00
parent 8137d71ba4
commit b3fc36cf3f

View File

@ -64,9 +64,8 @@ class DmsfFilesController < ApplicationController
access.action = DmsfFileRevisionAccess::DownloadAction access.action = DmsfFileRevisionAccess::DownloadAction
access.save! access.save!
# Allow a preview of the file by an external plugin # Allow a preview of the file by an external plugin
result = { processed: false } results = call_hook(:dmsf_files_controller_before_view, { file: @revision.disk_file })
call_hook(:dmsf_files_controller_before_view, { file: @revision.disk_file, result: result }) return if results.first == true
return if result[:processed]
member = Member.find_by(user_id: User.current.id, project_id: @file.project.id) member = Member.find_by(user_id: User.current.id, project_id: @file.project.id)
# IE has got a tendency to cache files # IE has got a tendency to cache files
expires_in 0.year, 'must-revalidate' => true expires_in 0.year, 'must-revalidate' => true