zendesk_apps_support 4.9.0 → 4.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/locales/en.yml +2 -0
- data/config/locales/translations/zendesk_apps_support.yml +5 -0
- data/lib/zendesk_apps_support/app_version.rb +4 -4
- data/lib/zendesk_apps_support/package.rb +1 -1
- data/lib/zendesk_apps_support/validations/manifest.rb +2 -6
- data/lib/zendesk_apps_support/validations/translations.rb +24 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dbd4a9dbbf9424033bd8c1194985d61b1df4b13
|
4
|
+
data.tar.gz: b911d0565982c5fc80b676e2ddb0af99bd17ea9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e0518cb6f9c12ae6645de44eb7bf245db885acc9e62e0d295c481a14fb4514a875d1b58da064deefe3d24f5166e8c595cd8ff51a2c28df9885bb2c0d0fb8bb8
|
7
|
+
data.tar.gz: 21373506c95063e03c5497188c5988ab33eedfd5f6d3de74ce5a0923e6e6548952644f5a37ba1cf7504f10ef576ac6dee6491f0ade50b8b42edb1e951ad28bc1
|
data/config/locales/en.yml
CHANGED
@@ -97,6 +97,8 @@ en:
|
|
97
97
|
not_json: "%{file} is not valid JSON. %{errors}"
|
98
98
|
not_json_object: "%{file} is not a JSON object."
|
99
99
|
missing_required_key: 'Missing required key from %{file}: %{missing_key}'
|
100
|
+
missing_required_key_on_leaf: Missing required key %{missing_key} on
|
101
|
+
leaf %{leaf} from %{file}
|
100
102
|
missing_required_key_for_product: 'Missing required key from %{file}
|
101
103
|
for %{product}: %{missing_key}'
|
102
104
|
products_do_not_match_manifest_products: Products in manifest (%{manifest_products})
|
@@ -254,6 +254,11 @@ parts:
|
|
254
254
|
key: "txt.apps.admin.error.app_build.translation.missing_required_key"
|
255
255
|
title: "App builder job: required key missing from translation file"
|
256
256
|
value: "Missing required key from %{file}: %{missing_key}"
|
257
|
+
- translation:
|
258
|
+
key: "txt.apps.admin.error.app_build.translation.missing_required_key_on_leaf"
|
259
|
+
title: "App builder job: required key missing from translation file."
|
260
|
+
screenshot: "https://zendesk.box.com/s/m6yr2j0vai0a7qkimj2gcqiy61jznmn4"
|
261
|
+
value: "Missing required key %{missing_key} on leaf %{leaf} from %{file}"
|
257
262
|
- translation:
|
258
263
|
key: "txt.apps.admin.error.app_build.translation.missing_required_key_for_product"
|
259
264
|
title: "App builder job: required key missing from translation file for a specific product"
|
@@ -11,12 +11,12 @@ module ZendeskAppsSupport
|
|
11
11
|
# newly created or updates apps MAY target it, but it
|
12
12
|
# may change without notice
|
13
13
|
class AppVersion
|
14
|
-
DEPRECATED = '0.5'
|
15
|
-
SUNSETTING =
|
14
|
+
DEPRECATED = ['0.5', '1.0'].freeze
|
15
|
+
SUNSETTING = nil
|
16
16
|
CURRENT = '2.0'
|
17
17
|
FUTURE = nil
|
18
18
|
|
19
|
-
TO_BE_SERVED = [DEPRECATED, SUNSETTING, CURRENT, FUTURE].compact.freeze
|
19
|
+
TO_BE_SERVED = [DEPRECATED, SUNSETTING, CURRENT, FUTURE].flatten.compact.freeze
|
20
20
|
VALID_FOR_UPDATE = [SUNSETTING, CURRENT, FUTURE].compact.freeze
|
21
21
|
VALID_FOR_CREATE = [CURRENT, FUTURE].compact.freeze
|
22
22
|
|
@@ -41,7 +41,7 @@ module ZendeskAppsSupport
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def deprecated?
|
44
|
-
@version
|
44
|
+
DEPRECATED.include?(@version)
|
45
45
|
end
|
46
46
|
|
47
47
|
def sunsetting?
|
@@ -130,7 +130,7 @@ module ZendeskAppsSupport
|
|
130
130
|
location_icons: location_icons,
|
131
131
|
app_class_name: app_class_name,
|
132
132
|
author: manifest.author,
|
133
|
-
translations: runtime_translations(translations_for(locale)),
|
133
|
+
translations: manifest.iframe_only? ? nil : runtime_translations(translations_for(locale)),
|
134
134
|
framework_version: manifest.framework_version,
|
135
135
|
templates: templates,
|
136
136
|
modules: commonjs_modules,
|
@@ -58,7 +58,7 @@ module ZendeskAppsSupport
|
|
58
58
|
errors << invalid_v1_location(package)
|
59
59
|
errors << missing_framework_version(manifest)
|
60
60
|
errors << location_framework_mismatch(manifest)
|
61
|
-
errors << invalid_version_error(manifest
|
61
|
+
errors << invalid_version_error(manifest)
|
62
62
|
end
|
63
63
|
|
64
64
|
errors << ban_no_template(manifest) if manifest.iframe_only?
|
@@ -293,14 +293,10 @@ module ZendeskAppsSupport
|
|
293
293
|
missing_keys_validation_error([RUBY_TO_JSON[:framework_version]]) if manifest.framework_version.nil?
|
294
294
|
end
|
295
295
|
|
296
|
-
def invalid_version_error(manifest
|
296
|
+
def invalid_version_error(manifest)
|
297
297
|
valid_to_serve = AppVersion::TO_BE_SERVED
|
298
298
|
target_version = manifest.framework_version
|
299
299
|
|
300
|
-
if target_version == AppVersion::DEPRECATED
|
301
|
-
package.warnings << I18n.t('txt.apps.admin.warning.app_build.deprecated_version')
|
302
|
-
end
|
303
|
-
|
304
300
|
unless valid_to_serve.include?(target_version)
|
305
301
|
return ValidationError.new(:invalid_version,
|
306
302
|
target_version: target_version,
|
@@ -16,7 +16,7 @@ module ZendeskAppsSupport
|
|
16
16
|
package.files.each_with_object([]) do |file, errors|
|
17
17
|
path_match = TRANSLATIONS_PATH.match(file.relative_path)
|
18
18
|
next unless path_match
|
19
|
-
errors << locale_error(file, path_match[1]) << json_error(file)
|
19
|
+
errors << locale_error(file, path_match[1]) << json_error(file) << format_error(file)
|
20
20
|
next unless errors.compact.empty?
|
21
21
|
errors.push(*validate_marketplace_content(file, package)) if file.relative_path == 'translations/en.json'
|
22
22
|
end.compact
|
@@ -29,9 +29,23 @@ module ZendeskAppsSupport
|
|
29
29
|
ValidationError.new('translation.invalid_locale', file: file.relative_path)
|
30
30
|
end
|
31
31
|
|
32
|
+
def format_error(file)
|
33
|
+
with_valid_json(file) do |json|
|
34
|
+
if json['app'] && json['app']['parameters']
|
35
|
+
parameters_node = json['app']['parameters']
|
36
|
+
parameters_node.keys.map do |param|
|
37
|
+
unless parameters_node[param].is_a?(Hash) && parameters_node[param].keys.include?('label')
|
38
|
+
return ValidationError.new('translation.missing_required_key_on_leaf',
|
39
|
+
file: file.relative_path, missing_key: 'label', leaf: param)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
nil
|
45
|
+
end
|
46
|
+
|
32
47
|
def json_error(file)
|
33
|
-
|
34
|
-
if json.is_a?(Hash)
|
48
|
+
with_valid_json(file) do |json|
|
35
49
|
if json['app'] && json['app']['package']
|
36
50
|
json['app'].delete('package')
|
37
51
|
begin
|
@@ -41,6 +55,13 @@ module ZendeskAppsSupport
|
|
41
55
|
ValidationError.new('translation.invalid_format', field: e.message)
|
42
56
|
end
|
43
57
|
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def with_valid_json(file)
|
62
|
+
json = JSON.parse(file.read)
|
63
|
+
if json.is_a?(Hash)
|
64
|
+
yield json
|
44
65
|
else
|
45
66
|
ValidationError.new('translation.not_json_object', file: file.relative_path)
|
46
67
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_apps_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.9.
|
4
|
+
version: 4.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James A. Rosen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2018-02-
|
14
|
+
date: 2018-02-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|