diff --git a/Gemfile b/Gemfile index a927d2e08..6eed6e153 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,6 @@ gem "importmap-rails" gem "propshaft" gem "stimulus-rails" gem "turbo-rails" -gem "local_time" # Deployment and drivers gem "bootsnap", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 1526749a3..2a1789a26 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -145,7 +145,6 @@ GEM reline (>= 0.4.2) json (2.7.2) language_server-protocol (3.17.0.3) - local_time (3.0.2) logger (1.6.1) loofah (2.22.0) crass (~> 1.0.2) @@ -327,7 +326,6 @@ DEPENDENCIES capybara debug importmap-rails - local_time propshaft puma (>= 5.0) rails! diff --git a/app/javascript/application.js b/app/javascript/application.js index e917b49c5..0d7b49404 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,4 +1,3 @@ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails import "@hotwired/turbo-rails" -import "initializers" import "controllers" diff --git a/app/javascript/controllers/animation_controller.js b/app/javascript/controllers/animation_controller.js index 9fd0998d8..a6fe306a2 100644 --- a/app/javascript/controllers/animation_controller.js +++ b/app/javascript/controllers/animation_controller.js @@ -1,5 +1,5 @@ import { Controller } from "@hotwired/stimulus" -import { nextFrame } from "helpers" +import { nextFrame } from "helpers/timing_helpers" export default class extends Controller { static classes = [ "play" ] diff --git a/app/javascript/controllers/filter_controller.js b/app/javascript/controllers/filter_controller.js index 953ae3a29..815b05952 100644 --- a/app/javascript/controllers/filter_controller.js +++ b/app/javascript/controllers/filter_controller.js @@ -1,5 +1,5 @@ import { Controller } from "@hotwired/stimulus" -import { debounce } from "helpers" +import { debounce } from "helpers/timing_helpers" export default class extends Controller { static targets = [ "list" ] diff --git a/app/javascript/controllers/thread_controller.js b/app/javascript/controllers/thread_controller.js deleted file mode 100644 index 0671c8361..000000000 --- a/app/javascript/controllers/thread_controller.js +++ /dev/null @@ -1,13 +0,0 @@ -import { Controller } from "@hotwired/stimulus" - -export default class extends Controller { - static classes = [ "myComment" ] - - connect() { - this.#myComments.forEach(comment => comment.classList.add(this.myCommentClass)) - } - - get #myComments() { - return this.element.querySelectorAll(`.comment[data-creator-id='${Current.user.id}']`) - } -} diff --git a/app/javascript/helpers/index.js b/app/javascript/helpers/index.js deleted file mode 100644 index c33ab8c40..000000000 --- a/app/javascript/helpers/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from "helpers/timing_helpers" diff --git a/app/javascript/initializers/current.js b/app/javascript/initializers/current.js deleted file mode 100644 index 96ace04b5..000000000 --- a/app/javascript/initializers/current.js +++ /dev/null @@ -1,15 +0,0 @@ -class Current { - get user() { - const currentUserId = this.#extractContentFromMetaTag("current-user-id") - - if (currentUserId) { - return { id: parseInt(currentUserId) } - } - } - - #extractContentFromMetaTag(name) { - return document.head.querySelector(`meta[name="${name}"]`)?.getAttribute("content") - } -} - -window.Current = new Current() diff --git a/app/javascript/initializers/index.js b/app/javascript/initializers/index.js deleted file mode 100644 index c86bbda03..000000000 --- a/app/javascript/initializers/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import "initializers/current" -import "initializers/local_time" diff --git a/app/javascript/initializers/local_time.js b/app/javascript/initializers/local_time.js deleted file mode 100644 index 8b294a5d5..000000000 --- a/app/javascript/initializers/local_time.js +++ /dev/null @@ -1,2 +0,0 @@ -import LocalTime from "local-time" -LocalTime.start() diff --git a/app/models/bubble/thread.rb b/app/models/bubble/thread.rb index a87a4d4d3..8b0e28be5 100644 --- a/app/models/bubble/thread.rb +++ b/app/models/bubble/thread.rb @@ -13,10 +13,6 @@ class Bubble::Thread "bubbles/threads/thread" end - def cache_key - ActiveSupport::Cache.expand_cache_key bubble, :thread - end - private delegate :events, :comments, to: :bubble, private: true diff --git a/app/models/bubble/thread/rollup.rb b/app/models/bubble/thread/rollup.rb index 89d3d76b5..e98f8a00e 100644 --- a/app/models/bubble/thread/rollup.rb +++ b/app/models/bubble/thread/rollup.rb @@ -13,14 +13,10 @@ class Bubble::Thread::Rollup "bubbles/threads/rollup" end - def cache_key - ActiveSupport::Cache.expand_cache_key [ thread, entries.first, entries.last ], "rollup" - end - private attr_reader :thread, :entries, :first_position - delegate :local_time_ago, to: "ApplicationController.helpers", private: true + delegate :time_ago_in_words, to: "ApplicationController.helpers", private: true def first_position? first_position @@ -47,10 +43,10 @@ class Bubble::Thread::Rollup def summarize(entry, chunk_size) case entry.action when "created" - "added by #{entry.creator.name} #{local_time_ago(entry.created_at)}" + "added by #{entry.creator.name} #{time_ago_in_words(entry.created_at)} ago" when "assigned" summary = "assigned to #{entry.assignee_names.to_sentence}" - summary += " #{local_time_ago(entry.created_at)}" unless first_position? + summary += " #{time_ago_in_words(entry.created_at)} ago" unless first_position? summary when "boosted" "#{entry.creator.name} +#{chunk_size}" diff --git a/app/views/bubbles/threads/_entry.html.erb b/app/views/bubbles/threads/_entry.html.erb deleted file mode 100644 index f299a3e08..000000000 --- a/app/views/bubbles/threads/_entry.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%# Template Dependency: comments/comment %> -<%# Template Dependency: bubbles/threads/rollup %> -<%= render entry %> diff --git a/app/views/bubbles/threads/_rollup.html.erb b/app/views/bubbles/threads/_rollup.html.erb index aec078644..adbfd5138 100644 --- a/app/views/bubbles/threads/_rollup.html.erb +++ b/app/views/bubbles/threads/_rollup.html.erb @@ -1,3 +1,3 @@