Skip to content

Commit

Permalink
Merge branch 'develop' into private-rl_2278_email_display_name
Browse files Browse the repository at this point in the history
  • Loading branch information
martini committed Oct 29, 2018
2 parents 0cf674d + cefe250 commit 9fc841d
Show file tree
Hide file tree
Showing 20 changed files with 243 additions and 87 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Change Log

## [2.7.0](https://github.com/zammad/zammad/tree/2.7.0) (2018-xx-xx)
[Full Changelog](https://github.com/zammad/zammad/compare/2.6.0...2.7.0)
## [2.8.0](https://github.com/zammad/zammad/tree/2.8.0) (2018-xx-xx)
[Full Changelog](https://github.com/zammad/zammad/compare/2.7.0...2.8.0)

**Implemented enhancements:**

Expand All @@ -13,4 +13,3 @@



\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.x
2.8.x
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ class App.UiElement.ticket_perform_action
object: 'Ticket'
display: 'Ticket'
},
{
prefix: 'article'
object: 'TicketArticle'
display: 'Article'
},
{
prefix: 'user'
object: 'User'
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/app/controllers/report.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class Graph extends App.ControllerContent
else if @params.timeRange is 'week'
xaxis = [[0, 'Mon'], [1, 'Tue'], [2, 'Wed'], [3, 'Thr'], [4, 'Fri'], [5, 'Sat'], [6, 'Sun'] ]
else
xaxis = [[0, 'Jan'], [1, 'Feb'], [2, 'Mar'], [3, 'Apr'], [4, 'Mai'], [5, 'Jun'], [6, 'Jul'], [7, 'Aug'], [8, 'Sep'], [9, 'Oct'], [10, 'Nov'], [11, 'Dec']]
xaxis = [[0, 'Jan'], [1, 'Feb'], [2, 'Mar'], [3, 'Apr'], [4, 'May'], [5, 'Jun'], [6, 'Jul'], [7, 'Aug'], [8, 'Sep'], [9, 'Oct'], [10, 'Nov'], [11, 'Dec']]

dataPlot = []
for key, value of data
Expand Down Expand Up @@ -489,7 +489,7 @@ class TimePicker extends App.Controller
value: 4,
},
{
display: 'Mai'
display: 'May'
value: 5,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Index extends App.ControllerSubContent
value: 4,
},
{
display: 'Mai'
display: 'May'
value: 5,
},
{
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/app/lib/app_post/utils.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ class App.Utils

# the article we are replying to is an incoming call
else if article.from?.match(/@/)
articleNew.to = article.from
articleNew.to = App.Utils.parseAddressListLocal(article.from).join(', ')

# if sender is customer but in article.from is no email, try to get
# customers email via customer user
Expand Down Expand Up @@ -1146,7 +1146,7 @@ class App.Utils

html.find('img').each( (index) ->
src = $(@).attr('src')
if !src.match(/^data:/i)
if !src.match(/^(data|cid):/i) # <img src="cid: ..."> may mean broken emails (see issue #2305)
base64 = App.Utils._htmlImage2DataUrl(@)
$(@).attr('src', base64)
)
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/app/models/user.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class App.User extends App.Model
placement: placement
vip: vip
url: @imageUrl()
initials: @initials()

isOutOfOffice: ->
return false if @out_of_office isnt true
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/app/views/avatar.jst.eco
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<span class="avatar <%- @cssClass %>" style="background-image: url(<%- @url %>)"<%- @placement %><%- @data %>>
<span class="avatar <%- @cssClass %>" style="background-image: url(<%- @url %>)"<%- @placement %><%- @data %> data-initials="<%- @initials %>">
<%- @Icon('crown') if @vip %>
</span>
29 changes: 29 additions & 0 deletions app/assets/stylesheets/print.scss
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,35 @@ th.js-tableHead:not([data-column-key="icon"]) {

.avatar {
border: 1px solid black;

&:not(.avatar--unique) {
&:before {
content: attr(data-initials);
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
text-align: center;
font-size: 13px;
line-height: 40px;
}

&.size-30:before {
font-size: 10px;
line-height: 32px;
}

&.size-50:before {
font-size: 16px;
line-height: 52px;
}

&.size-80:before {
font-size: 26px;
line-height: 84px;
}
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ def initialize(id)
def perform
article = Ticket::Article.find(@article_id)

# set retry count
article.preferences['delivery_retry'] ||= 0
article.preferences['delivery_retry'] += 1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def perform
article = Ticket::Article.find(@article_id)

# set retry count
record.preferences['delivery_retry'] ||= 0
record.preferences['delivery_retry'] += 1
article.preferences['delivery_retry'] ||= 0
article.preferences['delivery_retry'] += 1

ticket = Ticket.lookup(id: article.ticket_id)
log_error(article, "Can't find ticket.preferences for Ticket.find(#{article.ticket_id})") if !ticket.preferences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def perform
article = Ticket::Article.find(@article_id)

# set retry count
record.preferences['delivery_retry'] ||= 0
record.preferences['delivery_retry'] += 1
article.preferences['delivery_retry'] ||= 0
article.preferences['delivery_retry'] += 1

ticket = Ticket.lookup(id: article.ticket_id)
log_error(article, "Can't find ticket.preferences for Ticket.find(#{article.ticket_id})") if !ticket.preferences
Expand Down Expand Up @@ -62,7 +62,7 @@ def perform
mention_ids.push user.id
end
article.to = to
article.preferences['twitter'] = {
article.preferences['twitter'] = TweetBase.preferences_cleanup(
mention_ids: mention_ids,
geo: tweet.geo,
retweeted: tweet.retweeted?,
Expand All @@ -74,7 +74,7 @@ def perform
favorited: tweet.favorited?,
truncated: tweet.truncated?,
created_at: tweet.created_at,
}
)
end
else
raise "Unknown tweet type '#{tweet.class}'"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class FixedTwitterTicketArticlePreferences5 < ActiveRecord::Migration[5.0]
class FixedTwitterTicketArticlePreferences7 < ActiveRecord::Migration[5.0]
def up

# return if it's a new setup
Expand All @@ -21,7 +21,7 @@ def up
next
end
if sub_level.class == Twitter::Place || sub_level.class == Twitter::Geo
value[sub_key] = sub_level.attrs
value[sub_key] = sub_level.to_h
changed = true
next
end
Expand All @@ -31,6 +31,17 @@ def up
changed = true
end
end

if article.preferences[:twitter]&.key?(:geo) && article.preferences[:twitter][:geo].nil?
article.preferences[:twitter][:geo] = {}
changed = true
end

if article.preferences[:twitter]&.key?(:place) && article.preferences[:twitter][:place].nil?
article.preferences[:twitter][:place] = {}
changed = true
end

next if !changed

article.save!
Expand Down
9 changes: 8 additions & 1 deletion db/migrate/20181017000001_cti_generic_api2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ def up
return if !column_exists?(:cti_logs, :initialized_at)
return if column_exists?(:cti_logs, :initialized_at_cleanup)

add_column :cti_logs, :initialized_at_cleanup, :timestamp, limit: 3, null: true
if ActiveRecord::Base.connection_config[:adapter] == 'mysql2'
# disable the MySQL strict_mode for the current connection
execute("SET sql_mode = ''")
add_column :cti_logs, :initialized_at_cleanup, :timestamp, limit: 3, null: true, default: '0000-00-00 00:00:00'
else
add_column :cti_logs, :initialized_at_cleanup, :timestamp, limit: 3, null: true
end

Cti::Log.connection.schema_cache.clear!
Cti::Log.reset_column_information

Expand Down
67 changes: 62 additions & 5 deletions lib/tweet_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def to_article(tweet, user, ticket, channel)
end

article_preferences = {
twitter: twitter_preferences,
twitter: self.class.preferences_cleanup(twitter_preferences),
links: [
{
url: "https://twitter.com/statuses/#{tweet.id}",
Expand All @@ -228,7 +228,7 @@ def to_article(tweet, user, ticket, channel)
type_id: Ticket::Article::Type.find_by(name: article_type).id,
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
internal: false,
preferences: preferences_cleanup(article_preferences),
preferences: article_preferences,
)
end

Expand Down Expand Up @@ -366,10 +366,50 @@ def direct_message_limit_reached(tweet, factor = 1)
false
end

def preferences_cleanup(preferences)
=begin
replace Twitter::Place and Twitter::Geo as hash and replace Twitter::NullObject with nil
preferences = TweetBase.preferences_cleanup(
twitter: twitter_preferences,
links: [
{
url: 'https://twitter.com/statuses/123',
target: '_blank',
name: 'on Twitter',
},
],
)
or
preferences = {
twitter: TweetBase.preferences_cleanup(twitter_preferences),
links: [
{
url: 'https://twitter.com/statuses/123',
target: '_blank',
name: 'on Twitter',
},
],
}
=end

def self.preferences_cleanup(preferences)

# replace Twitter::NullObject with nill to prevent elasticsearch index issue
preferences.each_value do |value|
preferences.each do |key, value|

if value.class == Twitter::Place || value.class == Twitter::Geo
preferences[key] = value.to_h
next
end
if value.class == Twitter::NullObject
preferences[key] = nil
next
end

next if !value.is_a?(Hash)

value.each do |sub_key, sub_level|
Expand All @@ -378,14 +418,31 @@ def preferences_cleanup(preferences)
next
end
if sub_level.class == Twitter::Place || sub_level.class == Twitter::Geo
value[sub_key] = sub_level.attrs
value[sub_key] = sub_level.to_h
next
end
next if sub_level.class != Twitter::NullObject

value[sub_key] = nil
end
end

if preferences[:twitter]
if preferences[:twitter][:geo].blank?
preferences[:twitter][:geo] = {}
end
if preferences[:twitter][:place].blank?
preferences[:twitter][:place] = {}
end
else
if preferences[:geo].blank?
preferences[:geo] = {}
end
if preferences[:place].blank?
preferences[:place] = {}
end
end

preferences
end

Expand Down
7 changes: 6 additions & 1 deletion public/assets/tests/html_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2944,7 +2944,7 @@ test('check getRecipientArticle format', function() {
sender: {
name: 'Customer',
},
from: article_customer.email,
from: 'article lastname <article_customer@example.com>',
to: 'some group',
message_id: 'message_id22',
created_by: {
Expand Down Expand Up @@ -3079,6 +3079,11 @@ test("htmlImage2DataUrl", function() {
result = App.Utils.htmlImage2DataUrl(source)
equal(result, should, source)

source = '<img src="cid:1234">some test'
should = '<img src="cid:1234">some test'
result = App.Utils.htmlImage2DataUrl(source)
equal(result, should, source)

});

source = '<img src="/assets/images/avatar-bg.png">some test'
Expand Down
Loading

0 comments on commit 9fc841d

Please sign in to comment.