diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 3ff9a6a90..553c1daf2 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -38,14 +38,15 @@ class Attachment < ApplicationRecord end def title - title = filename - if container && container.is_a?(StudentWork) && author_id != User.current.id - course = container&.homework_common&.course - unless User.current.teacher_of_course?(course) - title = "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{DCODES.sample(8).join}" + File.extname(filename) - end - end - title + filename + # title = filename + # if container && container.is_a?(StudentWork) && author_id != User.current.id + # course = container&.homework_common&.course + # unless User.current.teacher_of_course?(course) + # title = "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{DCODES.sample(8).join}" + File.extname(filename) + # end + # end + # title end def downloads_count