From a72675cf1aadba598b98a44dce5db1e802d9cb25 Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Fri, 20 Mar 2020 18:30:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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