From 8555395b499d23146fd952c94ace562a78a5638a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 23:42:23 +0000 Subject: [PATCH 1/2] Bump sidekiq from 4.1.4 to 6.5.10 Bumps [sidekiq](https://github.com/sidekiq/sidekiq) from 4.1.4 to 6.5.10. - [Changelog](https://github.com/sidekiq/sidekiq/blob/main/Changes.md) - [Commits](https://github.com/sidekiq/sidekiq/compare/v4.1.4...v6.5.10) --- updated-dependencies: - dependency-name: sidekiq dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 33 +++++++++++---------------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/Gemfile b/Gemfile index 7c31640..3a72bae 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem 'loofah', '~> 2.3.1' gem 'pg' gem 'puma', '~> 5.6.4' gem 'rails', '~> 6.1.7.8' -gem 'sidekiq', '~> 4.1.3' +gem 'sidekiq', '~> 6.5.10' gem 'simple_command' gem 'twitter', '~> 7.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index e49c678..1159d93 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,7 +75,7 @@ GEM multi_json (~> 1.0) net-http-persistent ast (2.4.2) - base64 (0.2.0) + base64 (0.3.0) bcrypt (3.1.20) better_errors (2.10.1) erubi (>= 1.0.0) @@ -89,8 +89,8 @@ GEM byebug (11.1.3) chronic (0.10.2) coderay (1.1.3) - concurrent-ruby (1.3.4) - connection_pool (2.4.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.3) crack (1.0.0) bigdecimal rexml @@ -202,8 +202,6 @@ GEM metaclass (~> 0.0.1) multi_json (1.15.0) multipart-post (2.4.1) - mustermann (3.0.2) - ruby2_keywords (~> 0.0.1) naught (1.1.0) net-http-persistent (4.0.2) connection_pool (~> 2.2) @@ -246,12 +244,9 @@ GEM puma (5.6.8) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.9) + rack (2.2.17) rack-cors (2.0.2) rack (>= 2.0.0) - rack-protection (3.2.0) - base64 (>= 0.1.0) - rack (~> 2.2, >= 2.2.4) rack-test (2.1.0) rack (>= 1.3) rails (6.1.7.8) @@ -286,7 +281,7 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - redis (3.3.5) + redis (4.8.1) regexp_parser (2.9.2) reline (0.5.9) io-console (~> 0.5) @@ -357,18 +352,12 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sidekiq (4.1.4) - concurrent-ruby (~> 1.0) - connection_pool (~> 2.2, >= 2.2.0) - redis (~> 3.2, >= 3.2.1) - sinatra (>= 1.4.7) + sidekiq (6.5.10) + connection_pool (>= 2.2.5, < 3) + rack (~> 2.0) + redis (>= 4.5.0, < 5) simple_command (1.0.1) simple_oauth (0.3.1) - sinatra (3.2.0) - mustermann (~> 3.0) - rack (~> 2.2, >= 2.2.4) - rack-protection (= 3.2.0) - tilt (~> 2.0) spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) @@ -383,7 +372,7 @@ GEM strscan (3.1.0) thor (1.3.1) thread_safe (0.3.6) - tilt (2.4.0) + tilt (2.6.1) timeout (0.4.1) twitter (7.0.0) addressable (~> 2.3) @@ -447,7 +436,7 @@ DEPENDENCIES rubocop (~> 1.65.1) rubocop-performance (~> 1.21.1) rubocop-rails (~> 2.25.1) - sidekiq (~> 4.1.3) + sidekiq (~> 6.5.10) simple_command spring spring-watcher-listen (~> 2.0.0) From eec0b45529c8ba9f164484a463bccbc7f52f797f Mon Sep 17 00:00:00 2001 From: Juan Pablo Diaz Date: Tue, 15 Jul 2025 20:09:22 -0400 Subject: [PATCH 2/2] refactor(url): consolidate URL helper logic and update dependencies #100 Move URL helper logic from app/lib to lib directory and simplify implementation Update Rails version to 7.1.3 and related gem dependencies Fix topic model to return nil in else case and add related topics in conference model --- Gemfile | 6 +- Gemfile.lock | 206 +++++++++++++++++++++++--------------- app/helpers/url_helper.rb | 7 ++ app/lib/url_helper.rb | 10 -- app/models/conference.rb | 17 ++-- app/models/topic.rb | 4 +- config/application.rb | 2 +- lib/url_helper.rb | 8 ++ 8 files changed, 158 insertions(+), 102 deletions(-) create mode 100644 app/helpers/url_helper.rb delete mode 100644 app/lib/url_helper.rb create mode 100644 lib/url_helper.rb diff --git a/Gemfile b/Gemfile index 3a72bae..cc9e089 100644 --- a/Gemfile +++ b/Gemfile @@ -10,10 +10,10 @@ end gem 'administrate', '~> 0.20.1' gem 'algolia', '~> 2.0.4' gem 'chronic' -gem 'loofah', '~> 2.3.1' +gem 'loofah', '~> 2.21' gem 'pg' gem 'puma', '~> 5.6.4' -gem 'rails', '~> 6.1.7.8' +gem 'rails', '~> 7.1.3' gem 'sidekiq', '~> 6.5.10' gem 'simple_command' gem 'twitter', '~> 7.0.0' @@ -40,7 +40,7 @@ gem 'rack-cors', :require => 'rack/cors' gem 'jwt' group :test do - gem 'mocha', '1.7.0', require: false + gem 'mocha', '~> 2.0', require: false gem 'webmock' end diff --git a/Gemfile.lock b/Gemfile.lock index 1159d93..7daa9d1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,65 +1,83 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.8) - actionpack (= 6.1.7.8) - activesupport (= 6.1.7.8) + actioncable (7.1.5.1) + actionpack (= 7.1.5.1) + activesupport (= 7.1.5.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.8) - actionpack (= 6.1.7.8) - activejob (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) + zeitwerk (~> 2.6) + actionmailbox (7.1.5.1) + actionpack (= 7.1.5.1) + activejob (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) mail (>= 2.7.1) - actionmailer (6.1.7.8) - actionpack (= 6.1.7.8) - actionview (= 6.1.7.8) - activejob (= 6.1.7.8) - activesupport (= 6.1.7.8) + net-imap + net-pop + net-smtp + actionmailer (7.1.5.1) + actionpack (= 7.1.5.1) + actionview (= 7.1.5.1) + activejob (= 7.1.5.1) + activesupport (= 7.1.5.1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.7.8) - actionview (= 6.1.7.8) - activesupport (= 6.1.7.8) - rack (~> 2.0, >= 2.0.9) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.2) + actionpack (7.1.5.1) + actionview (= 7.1.5.1) + activesupport (= 7.1.5.1) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.8) - actionpack (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.5.1) + actionpack (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.8) - activesupport (= 6.1.7.8) + actionview (7.1.5.1) + activesupport (= 7.1.5.1) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.8) - activesupport (= 6.1.7.8) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.5.1) + activesupport (= 7.1.5.1) globalid (>= 0.3.6) - activemodel (6.1.7.8) - activesupport (= 6.1.7.8) - activerecord (6.1.7.8) - activemodel (= 6.1.7.8) - activesupport (= 6.1.7.8) - activestorage (6.1.7.8) - actionpack (= 6.1.7.8) - activejob (= 6.1.7.8) - activerecord (= 6.1.7.8) - activesupport (= 6.1.7.8) + activemodel (7.1.5.1) + activesupport (= 7.1.5.1) + activerecord (7.1.5.1) + activemodel (= 7.1.5.1) + activesupport (= 7.1.5.1) + timeout (>= 0.4.0) + activestorage (7.1.5.1) + actionpack (= 7.1.5.1) + activejob (= 7.1.5.1) + activerecord (= 7.1.5.1) + activesupport (= 7.1.5.1) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (6.1.7.8) + activesupport (7.1.5.1) + base64 + benchmark (>= 0.3) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) + mutex_m + securerandom (>= 0.3) tzinfo (~> 2.0) - zeitwerk (~> 2.3) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) administrate (0.20.1) @@ -77,6 +95,7 @@ GEM ast (2.4.2) base64 (0.3.0) bcrypt (3.1.20) + benchmark (0.4.1) better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) @@ -95,7 +114,7 @@ GEM bigdecimal rexml crass (1.0.6) - date (3.3.4) + date (3.4.1) debug_inspector (1.2.0) devise (4.9.4) bcrypt (~> 3.0) @@ -109,7 +128,9 @@ GEM dotenv-rails (3.1.2) dotenv (= 3.1.2) railties (>= 6.1) + drb (2.2.3) equalizer (0.0.11) + erb (5.0.2) erubi (1.13.0) execjs (2.9.1) faraday (1.10.3) @@ -159,6 +180,10 @@ GEM i18n (1.14.5) concurrent-ruby (~> 1.0) io-console (0.7.2) + irb (1.15.2) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -183,9 +208,9 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) logger (1.6.0) - loofah (2.3.1) + loofah (2.24.1) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) mail (2.8.1) mini_mime (>= 0.1.1) net-imap @@ -194,25 +219,25 @@ GEM marcel (1.0.4) memoizable (0.4.2) thread_safe (~> 0.3, >= 0.3.1) - metaclass (0.0.4) method_source (1.1.0) mini_mime (1.1.5) minitest (5.24.1) - mocha (1.7.0) - metaclass (~> 0.0.1) + mocha (2.7.1) + ruby2_keywords (>= 0.0.5) multi_json (1.15.0) multipart-post (2.4.1) + mutex_m (0.3.0) naught (1.1.0) net-http-persistent (4.0.2) connection_pool (~> 2.2) - net-imap (0.4.14) + net-imap (0.5.9) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.3) nokogiri (1.16.7-arm64-darwin) @@ -229,6 +254,9 @@ GEM ast (~> 2.4.1) racc pg (1.5.7) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) progress_bar (1.3.4) highline (>= 1.6) options (~> 2.3.0) @@ -240,6 +268,9 @@ GEM pry (>= 0.13, < 0.15) pry-rails (0.3.11) pry (>= 0.13.0) + psych (5.2.6) + date + stringio public_suffix (6.0.1) puma (5.6.8) nio4r (~> 2.0) @@ -247,40 +278,50 @@ GEM rack (2.2.17) rack-cors (2.0.2) rack (>= 2.0.0) + rack-session (1.0.2) + rack (< 3) rack-test (2.1.0) rack (>= 1.3) - rails (6.1.7.8) - actioncable (= 6.1.7.8) - actionmailbox (= 6.1.7.8) - actionmailer (= 6.1.7.8) - actionpack (= 6.1.7.8) - actiontext (= 6.1.7.8) - actionview (= 6.1.7.8) - activejob (= 6.1.7.8) - activemodel (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.1.5.1) + actioncable (= 7.1.5.1) + actionmailbox (= 7.1.5.1) + actionmailer (= 7.1.5.1) + actionpack (= 7.1.5.1) + actiontext (= 7.1.5.1) + actionview (= 7.1.5.1) + activejob (= 7.1.5.1) + activemodel (= 7.1.5.1) + activerecord (= 7.1.5.1) + activestorage (= 7.1.5.1) + activesupport (= 7.1.5.1) bundler (>= 1.15.0) - railties (= 6.1.7.8) - sprockets-rails (>= 2.0.0) + railties (= 7.1.5.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) - railties (6.1.7.8) - actionpack (= 6.1.7.8) - activesupport (= 6.1.7.8) - method_source + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.1.5.1) + actionpack (= 7.1.5.1) + activesupport (= 7.1.5.1) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) + rdoc (6.14.2) + erb + psych (>= 4.0.0) redis (4.8.1) regexp_parser (2.9.2) reline (0.5.9) @@ -345,6 +386,7 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) + securerandom (0.4.1) selectize-rails (0.12.6) selenium-webdriver (4.23.0) base64 (~> 0.2) @@ -369,11 +411,12 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) + stringio (3.1.7) strscan (3.1.0) thor (1.3.1) thread_safe (0.3.6) tilt (2.6.1) - timeout (0.4.1) + timeout (0.4.3) twitter (7.0.0) addressable (~> 2.3) buftok (~> 0.2.0) @@ -399,14 +442,17 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.1) websocket (1.2.11) - websocket-driver (0.7.6) + websocket-driver (0.8.0) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) zeitwerk (2.6.17) PLATFORMS arm64-darwin-23 + arm64-darwin-24 x86_64-linux DEPENDENCIES @@ -421,8 +467,8 @@ DEPENDENCIES faraday jwt listen (>= 3.0.5, < 3.2) - loofah (~> 2.3.1) - mocha (= 1.7.0) + loofah (~> 2.21) + mocha (~> 2.0) octokit (~> 4.0) pg progress_bar (~> 1.3.0) @@ -430,7 +476,7 @@ DEPENDENCIES pry-rails puma (~> 5.6.4) rack-cors - rails (~> 6.1.7.8) + rails (~> 7.1.3) rspec-rails (~> 6.1.3) rss (~> 0.2.9) rubocop (~> 1.65.1) diff --git a/app/helpers/url_helper.rb b/app/helpers/url_helper.rb new file mode 100644 index 0000000..e01109a --- /dev/null +++ b/app/helpers/url_helper.rb @@ -0,0 +1,7 @@ +module UrlHelper + def self.fix_url(url) + # Basic stub: ensure url starts with http(s) + return nil if url.nil? + url =~ /^https?:\/\// ? url : "https://#{url}" + end +end diff --git a/app/lib/url_helper.rb b/app/lib/url_helper.rb deleted file mode 100644 index 8e26522..0000000 --- a/app/lib/url_helper.rb +++ /dev/null @@ -1,10 +0,0 @@ -class URLHelper - def self.fix_url url - url = url.strip - if !url.match /^http(s?)\:\/\// - "http://#{url}".gsub(/\/$/, '') - else - url - end - end -end diff --git a/app/models/conference.rb b/app/models/conference.rb index 2683b79..eb85449 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -1,3 +1,5 @@ +require_relative '../../lib/url_helper' + class Conference < ApplicationRecord include ActiveModel::Dirty include DateConcern @@ -17,6 +19,12 @@ class Conference < ApplicationRecord validates :uuid, uniqueness: { case_sensitive: true } before_validation :set_uuid, :fix_url + def fix_url + self.url = URLHelper.fix_url(url) if url.present? + self.cfpUrl = URLHelper.fix_url(cfpUrl) if cfpUrl.present? + self.cocUrl = URLHelper.fix_url(cocUrl) if cocUrl.present? + end + before_save :add_related_topic before_save :update_start_end_dates @@ -157,12 +165,6 @@ def fetch_twitter_followers_count end end - def fix_url - self.url = URLHelper.fix_url(url) if url.present? - self.cfpUrl = URLHelper.fix_url(cfpUrl) if cfpUrl.present? - self.cocUrl = URLHelper.fix_url(cocUrl) if cocUrl.present? - end - def algolia_index SyncConferenceService.new(self).add if Rails.env.production? end @@ -182,6 +184,9 @@ def tweet def add_related_topic related_topics = topics.map { |topic| Topic.related_topic(topic) }.compact.uniq + related_topics.each do |related_topic| + self.topics << related_topic unless self.topics.include?(related_topic) + end return if related_topics.empty? self.topics = topics | related_topics diff --git a/app/models/topic.rb b/app/models/topic.rb index d7a72a1..1cb5c74 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -7,8 +7,8 @@ def self.related_topic(topic) find_by(name: 'javascript') when 'scala', 'groovy' find_by(name: 'java') + else + nil end - - nil end end diff --git a/config/application.rb b/config/application.rb index 619d189..c4b8988 100644 --- a/config/application.rb +++ b/config/application.rb @@ -20,7 +20,7 @@ module ApiConfsTech class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.1 + config.load_defaults 5.2 # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers diff --git a/lib/url_helper.rb b/lib/url_helper.rb new file mode 100644 index 0000000..582d8bb --- /dev/null +++ b/lib/url_helper.rb @@ -0,0 +1,8 @@ +class URLHelper + def self.fix_url url + return nil if url.nil? + url = url.strip + url = url.gsub(/^https?:\/\//, '') + "http://#{url}".gsub(/\/$/, '') + end +end