diff --git a/app/assets/javascripts/app/models/ticket_article.coffee b/app/assets/javascripts/app/models/ticket_article.coffee
index dc98d58d8..6a4230742 100644
--- a/app/assets/javascripts/app/models/ticket_article.coffee
+++ b/app/assets/javascripts/app/models/ticket_article.coffee
@@ -27,8 +27,8 @@ class App.TicketArticle extends App.Model
displayName: ->
if @subject
return @subject
- if App.Ticket.exists( @ticket_id )
- ticket = App.Ticket.find( @ticket_id )
+ if App.Ticket.exists(@ticket_id)
+ ticket = App.Ticket.find(@ticket_id)
if ticket
return ticket.title
'???'
diff --git a/app/assets/javascripts/app/views/generic/admin_level2/index.jst.eco b/app/assets/javascripts/app/views/generic/admin_level2/index.jst.eco
index 8a5e25c5c..697cfbc8e 100644
--- a/app/assets/javascripts/app/views/generic/admin_level2/index.jst.eco
+++ b/app/assets/javascripts/app/views/generic/admin_level2/index.jst.eco
@@ -13,7 +13,7 @@
diff --git a/app/models/channel/driver/imap.rb b/app/models/channel/driver/imap.rb
index 4bf18c08c..d2e0043bc 100644
--- a/app/models/channel/driver/imap.rb
+++ b/app/models/channel/driver/imap.rb
@@ -75,7 +75,7 @@ example
end
end
- Rails.logger.info "fetching imap (#{options[:host]}/#{options[:user]} port=#{port},ssl=#{ssl})"
+ Rails.logger.info "fetching imap (#{options[:host]}/#{options[:user]} port=#{port},ssl=#{ssl},folder=#{options[:folder]})"
# on check, reduce open_timeout to have faster probing
timeout = 45
@@ -173,20 +173,14 @@ example
message_meta = @imap.fetch(message_id, ['RFC822.SIZE', 'FLAGS', 'INTERNALDATE'])[0]
# ignore to big messages
- max_message_size = Setting.get('postmaster_max_size').to_f
- real_message_size = message_meta.attr['RFC822.SIZE'].to_f / 1024 / 1024
- if real_message_size > max_message_size
- info = " - ignore message #{count}/#{count_all} - because message is too big (is:#{real_message_size} MB/max:#{max_message_size} MB)"
- Rails.logger.info info
+ info = too_big?(message_meta, count, count_all)
+ if info
notice += "#{info}\n"
next
end
# ignore deleted messages
- if message_meta.attr['FLAGS'].include?(:Deleted)
- Rails.logger.info " - ignore message #{count}/#{count_all} - because message has already delete flag"
- next
- end
+ next if deleted?(message_meta, count, count_all)
# delete email from server after article was created
msg = @imap.fetch(message_id, 'RFC822')[0].attr['RFC822']
@@ -212,4 +206,24 @@ example
return if !@imap
@imap.disconnect()
end
+
+ private
+
+ def deleted?(message_meta, count, count_all)
+ return false if !message_meta.attr['FLAGS'].include?(:Deleted)
+ Rails.logger.info " - ignore message #{count}/#{count_all} - because message has already delete flag"
+ true
+ end
+
+ def too_big?(message_meta, count, count_all)
+ max_message_size = Setting.get('postmaster_max_size').to_f
+ real_message_size = message_meta.attr['RFC822.SIZE'].to_f / 1024 / 1024
+ if real_message_size > max_message_size
+ info = " - ignore message #{count}/#{count_all} - because message is too big (is:#{real_message_size} MB/max:#{max_message_size} MB)"
+ Rails.logger.info info
+ return info
+ end
+ false
+ end
+
end
diff --git a/app/models/channel/driver/twitter.rb b/app/models/channel/driver/twitter.rb
index 0216ea78b..7549e0700 100644
--- a/app/models/channel/driver/twitter.rb
+++ b/app/models/channel/driver/twitter.rb
@@ -202,6 +202,9 @@ returns
@stream_client.client.user(filter) do |tweet|
next if tweet.class != Twitter::Tweet && tweet.class != Twitter::DirectMessage
+
+ # wait until own posts are stored in local database to prevent importing own tweets
+ sleep 4
next if Ticket::Article.find_by(message_id: tweet.id)
# check direct message
diff --git a/app/models/channel/email_parser.rb b/app/models/channel/email_parser.rb
index 8d1d6e5f3..16b202e9a 100644
--- a/app/models/channel/email_parser.rb
+++ b/app/models/channel/email_parser.rb
@@ -30,9 +30,9 @@ class Channel::EmailParser
data: 'binary of attachment',
filename: 'file_name_of_attachment.txt',
preferences: {
- content-alternative: true,
- Mime-Type: 'text/plain',
- Charset: 'iso-8859-1',
+ 'content-alternative' => true,
+ 'Mime-Type' => 'text/plain',
+ 'Charset: => 'iso-8859-1',
},
},
],
diff --git a/app/models/channel/filter/follow_up_check.rb b/app/models/channel/filter/follow_up_check.rb
index 7024b195b..b568b6a04 100644
--- a/app/models/channel/filter/follow_up_check.rb
+++ b/app/models/channel/filter/follow_up_check.rb
@@ -4,13 +4,13 @@ module Channel::Filter::FollowUpCheck
def self.run(_channel, mail)
- return if mail[ 'x-zammad-ticket-id'.to_sym ]
+ return if mail['x-zammad-ticket-id'.to_sym]
# get ticket# from subject
ticket = Ticket::Number.check(mail[:subject])
if ticket
Rails.logger.debug "Follow up for '##{ticket.number}' in subject."
- mail[ 'x-zammad-ticket-id'.to_sym ] = ticket.id
+ mail['x-zammad-ticket-id'.to_sym] = ticket.id
return true
end
@@ -21,7 +21,7 @@ module Channel::Filter::FollowUpCheck
ticket = Ticket::Number.check(mail[:body])
if ticket
Rails.logger.debug "Follow up for '##{ticket.number}' in body."
- mail[ 'x-zammad-ticket-id'.to_sym ] = ticket.id
+ mail['x-zammad-ticket-id'.to_sym] = ticket.id
return true
end
end
@@ -33,13 +33,13 @@ module Channel::Filter::FollowUpCheck
ticket = Ticket::Number.check(attachment[:data])
next if !ticket
Rails.logger.debug "Follow up for '##{ticket.number}' in attachment."
- mail[ 'x-zammad-ticket-id'.to_sym ] = ticket.id
+ mail['x-zammad-ticket-id'.to_sym] = ticket.id
return true
}
end
# get ticket# from references
- if setting.include?('references') || (mail[ 'x-zammad-is-auto-response'.to_sym ] == true || Setting.get('ticket_hook_position') == 'none')
+ if setting.include?('references') || (mail['x-zammad-is-auto-response'.to_sym] == true || Setting.get('ticket_hook_position') == 'none')
# get all references 'References' + 'In-Reply-To'
references = ''
@@ -59,7 +59,7 @@ module Channel::Filter::FollowUpCheck
article = Ticket::Article.where(message_id_md5: message_id_md5).order('created_at DESC, id DESC').limit(1).first
next if !article
Rails.logger.debug "Follow up for '##{article.ticket.number}' in references."
- mail[ 'x-zammad-ticket-id'.to_sym ] = article.ticket_id
+ mail['x-zammad-ticket-id'.to_sym] = article.ticket_id
return true
}
end
@@ -98,7 +98,7 @@ module Channel::Filter::FollowUpCheck
next if subject_to_check != article_first.subject
Rails.logger.debug "Follow up for '##{article.ticket.number}' in references with same subject as inital article."
- mail[ 'x-zammad-ticket-id'.to_sym ] = article_first.ticket_id
+ mail['x-zammad-ticket-id'.to_sym] = article_first.ticket_id
return true
}
end
diff --git a/app/models/store/file.rb b/app/models/store/file.rb
index 5d5c955f4..c430e3610 100644
--- a/app/models/store/file.rb
+++ b/app/models/store/file.rb
@@ -106,9 +106,13 @@ move files from db backend to fs
Store::File.move('DB', 'File')
+nice move to keep system responsive
+
+ Store::File.move('DB', 'File', delay_in_sec) # e. g. 1
+
=end
- def self.move(source, target)
+ def self.move(source, target, delay = nil)
adapter_source = load_adapter("Store::Provider::#{source}")
adapter_target = load_adapter("Store::Provider::#{target}")
@@ -126,6 +130,8 @@ move files from db backend to fs
adapter_source.delete(item.sha)
logger.info "Moved file #{item.sha} from #{source} to #{target}"
+
+ sleep delay if delay
}
true
end