Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add timestamps to user_preferences table. Thus we know when the cached styles are invalid and needs to be reloaded.

Henriette Dargec4141fb9f1d6
diff --git a/app/helpers/highlighting_helper.rb b/app/helpers/highlighting_helper.rb
index 1e15a2227f2..eadd74133eb 100644
--- a/app/helpers/highlighting_helper.rb
+++ b/app/helpers/highlighting_helper.rb
@@ -4,6 +4,6 @@ module HighlightingHelper
end
def highlight_css_updated_at
- ApplicationRecord.most_recently_changed Status, IssuePriority, Type
+ ApplicationRecord.most_recently_changed Status, IssuePriority, Type, UserPreference
end
end
diff --git a/db/migrate/20240703131639_add_timestamps_to_user_preferences.rb b/db/migrate/20240703131639_add_timestamps_to_user_preferences.rb
new file mode 100644
index 00000000000..c147e67efc8
--- /dev/null
+++ b/db/migrate/20240703131639_add_timestamps_to_user_preferences.rb
@@ -0,0 +1,5 @@
+class AddTimestampsToUserPreferences < ActiveRecord::Migration[7.1]
+ def change
+ add_timestamps :user_preferences, default: DateTime.now
+ end
+end
diff --git a/spec/models/user_preference_spec.rb b/spec/models/user_preference_spec.rb
index 27203501408..2d178a9bf87 100644
--- a/spec/models/user_preference_spec.rb
+++ b/spec/models/user_preference_spec.rb
@@ -61,24 +61,6 @@ RSpec.describe UserPreference do
end
end
- describe "#respond_to?" do
- context "for created_at (key not in the schema)" do
- it "is does not respond" do
- expect(preference)
- .not_to respond_to(:created_at)
- end
- end
- end
-
- describe "an unsupported method" do
- context "for created_at (key not in the schema)" do
- it "raises an error" do
- expect { preference.created_at }
- .to raise_error NoMethodError
- end
- end
- end
-
describe "sort order" do
it_behaves_like "accepts real and false booleans",
:comments_in_reverse_order=,