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

bug/61708 Cannot delete users who used emoji reactions (#18053)

Kabiru Mwenjacf643f93b16c
diff --git a/app/models/user.rb b/app/models/user.rb
index e5f2d462219..88bbc9b697b 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -91,6 +91,7 @@ class User < Principal
inverse_of: :user,
dependent: :destroy
+ has_many :emoji_reactions, dependent: :destroy
has_many :remote_identities, dependent: :destroy
# Users blocked via brute force prevention
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 11e084ab73a..884b7dfd8d5 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -47,6 +47,10 @@ RSpec.describe User do
status:)
end
+ describe "Associations" do
+ it { is_expected.to have_many(:emoji_reactions).dependent(:destroy) }
+ end
+
describe "with long but allowed attributes" do
it "is valid" do
user.firstname = "a" * 256