Commit
486e450c98f4730bd066262e929845ce4baad4fc
Exists in
staging
and in
42 other branches
all_pending_tasks_api, api-articles-period, api_roles, caching-rails4, captcha_serpro_plugin, comments_permissions, content-manager-hostspot, elasticsearch, elasticsearch_api, elasticsearch_categories, elasticsearch_filter, elasticsearch_sort, elasticsearch_to_merge, elasticsearch_view, environment-exposes-api, export-comment-api, export-comment-paragraph, export_data, external_followers, federation-webfinger, federation_followers, federation_followers_backend, federation_oauth_provider, federation_webfinger, fix_event_date_issue, fix_notification_email, fix_string_downcase_and_upcase, follower_permition, json_cookie_serializer, login-captcha, master, master_profile_followers, oauth_external_login, oauth_login, private-scraps, private-scraps-rebase, production, production-vendorized, profile_api_improvements, tasks_keep_filter_params, user_mention, webfinger_server
blocks: make sure limit is integer on get_limit
Blocks configured before the definition of limit type were strings and were
crashing
| @@ -23,7 +23,7 @@ class Block < ActiveRecord::Base |
| @@ -23,7 +23,7 @@ class Block < ActiveRecord::Base |
23
| end |
23
| end |
24
| |
24
| |
25
| def get_limit |
25
| def get_limit |
26
| - [0,limit].max |
26
| + [0,limit.to_i].max |
27
| end |
27
| end |
28
| |
28
| |
29
| def embed_code |
29
| def embed_code |
| @@ -330,4 +330,11 @@ class BlockTest < ActiveSupport::TestCase |
| @@ -330,4 +330,11 @@ class BlockTest < ActiveSupport::TestCase |
330
| block.save! |
330
| block.save! |
331
| assert !block.display_to_user?(person_friend) |
331
| assert !block.display_to_user?(person_friend) |
332
| end |
332
| end |
| |
333
| + |
| |
334
| + should 'get limit as a number when limit is string' do |
| |
335
| + block = RecentDocumentsBlock.new |
| |
336
| + block.settings[:limit] = '5' |
| |
337
| + assert block.get_limit.is_a?(Fixnum) |
| |
338
| + end |
| |
339
| + |
333
| end |
340
| end |