summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRajendra kadam <rajendrakadam249@gmail.com>2019-07-17 06:41:26 +0000
committerClement Ho <408677-ClemMakesApps@users.noreply.gitlab.com>2019-07-17 06:41:26 +0000
commitf8afb3805cf8cd12085c0e93bc6dad111afbd9c2 (patch)
tree53284acc02a0a98976d5e483344e24eef44e934c /lib
parentc1d370c904b0f6a0b6ebb27ebc3a5df7b693c4bb (diff)
downloadgitlab-ce-f8afb3805cf8cd12085c0e93bc6dad111afbd9c2.tar.gz
Fetch latest link in the description for zoom link, add more tests and remove frontend spec unnecessary tests
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/zoom_link_extractor.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/gitlab/zoom_link_extractor.rb b/lib/gitlab/zoom_link_extractor.rb
new file mode 100644
index 00000000000..d9994898a08
--- /dev/null
+++ b/lib/gitlab/zoom_link_extractor.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+# Detect links matching the following formats:
+# Zoom Start links: https://zoom.us/s/<meeting-id>
+# Zoom Join links: https://zoom.us/j/<meeting-id>
+# Personal Zoom links: https://zoom.us/my/<meeting-id>
+# Vanity Zoom links: https://gitlab.zoom.us/j/<meeting-id> (also /s and /my)
+
+module Gitlab
+ class ZoomLinkExtractor
+ ZOOM_REGEXP = %r{https://(?:[\w-]+\.)?zoom\.us/(?:s|j|my)/\S+}.freeze
+
+ def initialize(text)
+ @text = text.to_s
+ end
+
+ def links
+ @text.scan(ZOOM_REGEXP)
+ end
+ end
+end