Fixed article.from of twitter articles.

This commit is contained in:
Martin Edenhofer 2016-08-31 18:17:08 +02:00
parent c8230207ef
commit 73bded92f7

View file

@ -12,11 +12,17 @@ class Observer::Ticket::Article::FillupFromGeneral < ActiveRecord::Observer
# if article and sender type is set via *.postmaster)
return if ApplicationHandleInfo.current.split('.')[1] == 'postmaster'
# set from on all article types excluding email
# set from on all article types excluding email|twitter status|twitter direct-message|facebook feed post|facebook feed comment
return if !record.type_id
type = Ticket::Article::Type.lookup(id: record.type_id)
return if type['name'] == 'email'
# from will be set by channel backend
return if type['name'] == 'twitter status'
return if type['name'] == 'twitter direct-message'
return if type['name'] == 'facebook feed post'
return if type['name'] == 'facebook feed comment'
return if !record.created_by_id
user = User.find(record.created_by_id)
record.from = "#{user.firstname} #{user.lastname}"