Просмотр исходного кода

Merge branch 'master' of https://devel.mephi.ru/dyokunev/redmine_customnotifications

Conflicts:
	lib/redmine_customnotifications/patches/app/helpers/issues_helper.rb
Dmitry Yu Okunev лет назад: 7
Родитель
Сommit
2b886ab222

+ 34 - 0
lib/redmine_customnotifications/patches/app/controller/attachments_controller.rb

@@ -0,0 +1,34 @@
+module CustomNotifications
+	module AttachmentsControllerPatch
+		def self.included(base)
+			base.extend(ClassMethods)
+			base.send(:include, InstanceMethods)
+
+			base.class_eval do
+				alias_method_chain :download, customnotifications:
+			end
+		end
+
+		module ClassMethods
+		end
+
+		module InstanceMethods
+			def download_with_customnotifications
+				if @attachment.container.is_a?(Version) || @attachment.container.is_a?(Project)
+					@attachment.increment_download
+				end 
+
+				if stale?(:etag => @attachment.digest)
+					# images and pdfs are sent inline
+					send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
+									:type => detect_content_type(@attachment),
+									:disposition => (@attachment.image? || @attachment.pdf? ? 'inline' : 'attachment')
+				end 
+
+			end
+		end
+	end
+end
+
+AttachmentsController.send(:include, CustomNotifications::AttachmentsControllerPatch)
+

+ 5 - 1
lib/redmine_customnotifications/patches/app/helpers/issues_helper.rb

@@ -21,7 +21,11 @@ module CustomNotifications
 				return email_issue_attributes_without_customnotifications(issue, user) if issue.project_id != 15894 && issue.project_id != 16359
 
 				items = []
-				%w(author assigned_to category fixed_version).each do |attribute|
+				%w(author category fixed_version).each do |attribute|
+					if attribute == "category"
+						items << "Специалист: #{issue.send "category"}"
+						next
+					end
 					unless issue.disabled_core_fields.include?(attribute+"_id")
 						items << "#{l("field_#{attribute}")}: #{issue.send attribute}"
 					end