onebox 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 354e358f2909b92f1efa00092d3c82cc451760d9f8a0ee6628bb8b950f45ca2a
4
- data.tar.gz: 86bcb44cc263203075a8b0e972b7899a6942fb4b0e4fad4917089ecbbed2fd32
3
+ metadata.gz: 90c9d1f633caf0798657ff3655a0d41cca71364ed0199bc3beea5f686df4c148
4
+ data.tar.gz: 8360d4b10bf5af91a8905e09777bd305545a8db0448b9b80301b39b7bd37b1ca
5
5
  SHA512:
6
- metadata.gz: 254b44103190d101795ccce8a736dacc7e3e5d3159b0512b7539f39e4968dd750800455c9867abbafd8387ef1ae870974c581965d7b53e699187af532dda1961
7
- data.tar.gz: eff1b7f8c6add5760f5f7e6be3c1790a170e92a08ad6eb289b5a240702cfd40d681c2d3d437722dad20efe18a7a23ea154e67b60623f7f1e4a5aa651b00126e4
6
+ metadata.gz: 232104ac79cb41e53b404e90e930d1ed229f07df11dab37d72d5267366082f8d26a9d7185dd1b51a3dfe2d1eac9d71f30fddde58203fadffb8c209bcfdfa5cd2
7
+ data.tar.gz: f25d39bc21a67607a78924abee0d31ce18137d06fc672fe820cd9d0758a155e3e5370795c924bc1f404b2be41cfd93669c7709d9616043828ee1cca588afe2b4
@@ -286,7 +286,7 @@ module Onebox
286
286
  return image_html if is_image?
287
287
  return embedded_html if is_embedded?
288
288
  return card_html if is_card?
289
- return article_html if has_text?
289
+ return article_html if (has_text? || is_image_article?)
290
290
  end
291
291
 
292
292
  def is_card?
@@ -301,8 +301,15 @@ module Onebox
301
301
  end
302
302
 
303
303
  def has_text?
304
- !Onebox::Helpers.blank?(data[:title]) &&
305
- !Onebox::Helpers.blank?(data[:description])
304
+ has_title? && !Onebox::Helpers.blank?(data[:description])
305
+ end
306
+
307
+ def has_title?
308
+ !Onebox::Helpers.blank?(data[:title])
309
+ end
310
+
311
+ def is_image_article?
312
+ has_title? && has_image?
306
313
  end
307
314
 
308
315
  def is_image?
@@ -7,11 +7,11 @@ module Onebox
7
7
  include StandardEmbed
8
8
  include LayoutSupport
9
9
 
10
- matches_regexp(/^https?:\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/?(?:.*)\/p\/[a-zA-Z\d_-]+/)
10
+ matches_regexp(/^https?:\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/?(?:.*)\/(?:p|tv)\/[a-zA-Z\d_-]+/)
11
11
  always_https
12
12
 
13
13
  def clean_url
14
- url.scan(/^https?:\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/?(?:.*)\/p\/[a-zA-Z\d_-]+/).flatten.first
14
+ url.scan(/^https?:\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/?(?:.*)\/(?:p|tv)\/[a-zA-Z\d_-]+/).flatten.first
15
15
  end
16
16
 
17
17
  def data
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onebox
4
- VERSION = "2.2.0"
4
+ VERSION = "2.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-12-23 00:00:00.000000000 Z
13
+ date: 2020-12-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable