diff --git a/.ruby-version b/.ruby-version index 74500cee..460b6fd4 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.4 \ No newline at end of file +2.7.5 \ No newline at end of file diff --git a/Gemfile b/Gemfile index 84e1f626..bf68a3e8 100644 --- a/Gemfile +++ b/Gemfile @@ -107,8 +107,9 @@ group :production do end group :test, :production do - gem 'mini_racer' gem 'pg', '~> 1.2' + + gem "mini_racer", "~> 0.6.2" end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index e8418386..d914f35a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1264,7 +1264,7 @@ GEM bundler-audit (0.9.0.1) bundler (>= 1.2.0, < 3) thor (~> 1.0) - chartkick (4.0.5) + chartkick (4.1.3) childprocess (4.1.0) climate_control (0.2.0) cocoon (1.2.15) @@ -1330,8 +1330,8 @@ GEM rake filesize (0.2.0) flamegraph (0.9.5) - font-awesome-rails (4.7.0.7) - railties (>= 3.2, < 7) + font-awesome-rails (4.7.0.8) + railties (>= 3.2, < 8.0) friendly_id (5.4.2) activerecord (>= 4.0.0) globalid (0.5.2) @@ -1354,7 +1354,7 @@ GEM http-form_data (2.3.0) http-parser (1.2.3) ffi-compiler (>= 1.0, < 2.0) - i18n (1.8.10) + i18n (1.8.11) concurrent-ruby (~> 1.0) ibm_cloud_sdk_core (1.1.3) concurrent-ruby (~> 1.0) @@ -1399,11 +1399,12 @@ GEM kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) language_filter (0.3.01) - libv8-node (15.14.0.1) + libv8-node (16.10.0.0) + libv8-node (16.10.0.0-x86_64-linux) listen (3.7.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.12.0) + loofah (2.13.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -1425,19 +1426,21 @@ GEM rake mini_magick (4.11.0) mini_mime (1.1.2) - mini_portile2 (2.6.1) - mini_racer (0.4.0) - libv8-node (~> 15.14.0.0) - minitest (5.14.4) + mini_portile2 (2.7.1) + mini_racer (0.6.2) + libv8-node (~> 16.10.0.0) + minitest (5.15.0) multi_json (1.15.0) multipart-post (2.1.1) mustache (1.1.1) nested_form (0.3.2) netrc (0.11.0) - newrelic_rpm (8.0.0) + newrelic_rpm (8.3.0) nio4r (2.5.8) - nokogiri (1.12.5) - mini_portile2 (~> 2.6.1) + nokogiri (1.13.1) + mini_portile2 (~> 2.7.0) + racc (~> 1.4) + nokogiri (1.13.1-x86_64-linux) racc (~> 1.4) onebox (2.2.19) addressable (~> 2.8.0) @@ -1455,8 +1458,8 @@ GEM mime-types mimemagic (~> 0.3.0) terrapin (~> 0.6.0) - paranoia (2.4.3) - activerecord (>= 4.0, < 6.2) + paranoia (2.5.0) + activerecord (>= 5.1, < 7.1) paypal-checkout-sdk (1.0.4) paypalhttp (~> 1.0.1) paypal_client (0.4.0) @@ -1609,7 +1612,7 @@ GEM text-hyphen (1.4.1) textstat (0.1.7) text-hyphen (~> 1.4, >= 1.4.1) - thor (1.1.0) + thor (1.2.1) tilt (2.0.10) timeago_js (3.0.2.2) tribute (3.6.0.0) @@ -1623,12 +1626,12 @@ GEM uniform_notifier (1.14.2) warden (1.2.9) rack (>= 2.0.9) - web-console (4.1.0) + web-console (4.2.0) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webpacker (5.4.0) + webpacker (5.4.3) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) @@ -1642,10 +1645,11 @@ GEM websocket-extensions (0.1.5) word_count_analyzer (1.0.1) engtagger - zeitwerk (2.5.1) + zeitwerk (2.5.3) PLATFORMS ruby + x86_64-linux DEPENDENCIES active_storage_validations @@ -1681,7 +1685,7 @@ DEPENDENCIES medium-editor-rails memory_profiler meta-tags - mini_racer + mini_racer (~> 0.6.2) newrelic_rpm paperclip paranoia @@ -1722,4 +1726,4 @@ RUBY VERSION ruby 2.7.2p137 BUNDLED WITH - 2.1.4 + 2.3.5 diff --git a/README.rdoc b/README.rdoc index 009d2de7..0d91681e 100644 --- a/README.rdoc +++ b/README.rdoc @@ -3,7 +3,7 @@ {}[https://codeclimate.com/github/indentlabs/notebook/coverage] {Inline docs}[http://inch-ci.org/github/indentlabs/notebook] -== What is Notebook.ai? +== What is Notebook.ai? see {live website}[http://notebook.ai/] diff --git a/app/controllers/page_tags_controller.rb b/app/controllers/page_tags_controller.rb index ee41cc8a..0c677525 100644 --- a/app/controllers/page_tags_controller.rb +++ b/app/controllers/page_tags_controller.rb @@ -11,7 +11,12 @@ class PageTagsController < ApplicationController new_tag_name = 'Untitled Tag' end - current_user.page_tags.where(tag: old_tag_name).update_all(tag: new_tag_name) + new_slug = PageTagService.slug_for(new_tag_name) + + current_user.page_tags.where(tag: old_tag_name).update_all( + tag: new_tag_name, + slug: new_slug + ) end # Remove a tag and all of its links to a page diff --git a/app/models/page_data/page_tag.rb b/app/models/page_data/page_tag.rb index 79c2d9ff..604a362c 100644 --- a/app/models/page_data/page_tag.rb +++ b/app/models/page_data/page_tag.rb @@ -2,6 +2,8 @@ class PageTag < ApplicationRecord belongs_to :page, polymorphic: true belongs_to :user + after_update :update_slug_to_reflect_label_changes + # Delimiter to be used wherever we want to allow submitting multiple tags in a single string SUBMISSION_DELIMITER = ',,,|||,,,' @@ -12,4 +14,13 @@ class PageTag < ApplicationRecord def self.icon 'label' end + + def update_slug_to_reflect_label_changes + self.update_slug! if (saved_change_to_tag? && self.tag.present?) + end + + def update_slug! + new_slug = PageTagService.slug_for(self.tag) + self.update(slug: new_slug) unless new_slug == self.slug + end end diff --git a/app/views/content/components/_list_filter_bar.html.erb b/app/views/content/components/_list_filter_bar.html.erb index 955b2891..ec8edda4 100644 --- a/app/views/content/components/_list_filter_bar.html.erb +++ b/app/views/content/components/_list_filter_bar.html.erb @@ -69,7 +69,7 @@ <% if @page_tags %> <% @page_tags.each do |page_tag| %>
  • - <%= link_to params.permit(:tag, :favorite_only).merge({ slug: PageTagService.slug_for(page_tag.tag) }), class: content_type.text_color do %> + <%= link_to params.permit(:tag, :favorite_only).merge({ slug: page_tag.slug }), class: content_type.text_color do %> <%= PageTag.icon %> tagged <%= page_tag.tag %> diff --git a/app/views/share_comments/_show.html.erb b/app/views/share_comments/_show.html.erb index 89e8a0a8..0616e275 100644 --- a/app/views/share_comments/_show.html.erb +++ b/app/views/share_comments/_show.html.erb @@ -24,7 +24,7 @@ <%= time_ago_in_words comment.created_at %> ago - <% if user_signed_in? && (share.user == current_user || comment.user == current_user) %> + <% if user_signed_in? && (share.user_id == current_user.id || comment.user_id == current_user.id) %> more_vert diff --git a/yarn.lock b/yarn.lock index 03402c40..85a13343 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3210,9 +3210,9 @@ flush-write-stream@^1.0.0: readable-stream "^2.3.6" follow-redirects@^1.0.0, follow-redirects@^1.14.0: - version "1.14.4" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379" - integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g== + version "1.14.7" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685" + integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ== for-in@^1.0.2: version "1.0.2"