diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee index ba0bd079d..66e3b2c00 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -2093,6 +2093,9 @@ class App.ControllerForm extends App.Controller # sort attribute.options _sortOptions: (attribute) -> + # skip sorting if it is disabled by config + return if attribute.sortBy == null + return if !attribute.options if _.isArray( attribute.options ) diff --git a/app/assets/javascripts/app/lib/app_post/utils.js.coffee b/app/assets/javascripts/app/lib/app_post/utils.js.coffee index f008f1e90..a3096c1bc 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.js.coffee @@ -114,6 +114,9 @@ class App.Utils # htmlOnlyWithRichtext = App.Utils.htmlRemoveRichtext( html ) @htmlRemoveRichtext: (html) -> + # remove comments + @_removeComments( html ) + # remove style and class @_removeAttributes( html ) @@ -130,6 +133,9 @@ class App.Utils # cleanHtmlWithRichText = App.Utils.htmlCleanup( html ) @htmlCleanup: (html) -> + # remove comments + @_removeComments( html ) + # remove style and class @_removeAttributes( html ) @@ -169,6 +175,13 @@ class App.Utils .removeAttr( 'title' ) html + @_removeComments: (html) -> + html.contents().each( -> + if @nodeType == 8 + $(@).remove() + ) + html + # signatureNeeded = App.Utils.signatureCheck( message, signature ) @signatureCheck: (message, signature) -> messageText = $( '
' + message + '
' ).text().trim() diff --git a/app/models/translation.rb b/app/models/translation.rb index dbd4dce86..2f4d9cb58 100644 --- a/app/models/translation.rb +++ b/app/models/translation.rb @@ -15,40 +15,42 @@ load translations from online =end def self.load - url = 'https://i18n.zammad.com/api/v1/translations' - if !UserInfo.current_user_id - UserInfo.current_user_id = 1 - end - result = UserAgent.get( - url, - {}, - { - json: true, - } - ) - fail "Can't load translations from #{url}: #{result.error}" if !result.success? + Locale.where(active: true).each {|locale| + url = "https://i18n.zammad.com/api/v1/translations/#{locale.locale}" + if !UserInfo.current_user_id + UserInfo.current_user_id = 1 + end + result = UserAgent.get( + url, + {}, + { + json: true, + } + ) + fail "Can't load translations from #{url}: #{result.error}" if !result.success? - ActiveRecord::Base.transaction do - result.data.each {|translation| + ActiveRecord::Base.transaction do + result.data.each {|translation| - # handle case insensitive sql - exists = Translation.where(locale: translation['locale'], format: translation['format'], source: translation['source']) - translaten = nil - exists.each {|item| - if item.source == translation['source'] - translaten = item + # handle case insensitive sql + exists = Translation.where(locale: translation['locale'], format: translation['format'], source: translation['source']) + translaten = nil + exists.each {|item| + if item.source == translation['source'] + translaten = item + end + } + if translaten + + # verify if update is needed + translaten.update_attributes(translation.symbolize_keys!) + translaten.save + else + Translation.create(translation.symbolize_keys!) end } - if translaten - - # verify if update is needed - translaten.update_attributes(translation.symbolize_keys!) - translaten.save - else - Translation.create(translation.symbolize_keys!) - end - } - end + end + } true end diff --git a/lib/service/image.rb b/lib/service/image.rb index 0d3b87c7c..4dd1fb78b 100644 --- a/lib/service/image.rb +++ b/lib/service/image.rb @@ -56,7 +56,7 @@ returns =begin -find organization image suggestion +find organization image suggestion and store it as app logo result = Service::Image.organization_suggest('edenhofer.de') @@ -72,7 +72,14 @@ returns backend = load_adapter_by_setting( 'image_backend' ) return if !backend - backend.organization_suggest(domain) + result = backend.organization_suggest(domain) + + # sync logo to assets folder + if result + StaticAssets.sync + end + + result end end diff --git a/public/assets/tests/html-utils.js b/public/assets/tests/html-utils.js index 1e8ea4640..18e42afc1 100644 --- a/public/assets/tests/html-utils.js +++ b/public/assets/tests/html-utils.js @@ -256,7 +256,7 @@ test( "htmlRemoveTags", function() { // htmlRemoveRichtext test( "htmlRemoveRichtext", function() { - var source = "
test
" + var source = "
test
" var should = "test" var result = App.Utils.htmlRemoveRichtext( $(source) ) equal( result.html(), should, source ) @@ -330,7 +330,7 @@ test( "htmlRemoveRichtext", function() { // htmlCleanup test( "htmlCleanup", function() { - var source = "
test
" + var source = "
test
" var should = "test" var result = App.Utils.htmlCleanup( $(source) ) equal( result.html(), should, source )