Skip to content

Commit

Permalink
Fix bug regarding user group moderation action logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ahukkanen authored and alecslupu committed Jan 26, 2023
1 parent 730e5e6 commit b7422d2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Expand Up @@ -52,7 +52,7 @@ def unreported_user_presenter
end

def unreported_user
@unreported_user ||= Decidim::User.find_by(id: action_log.extra.dig("extra", "user_id"))
@unreported_user ||= Decidim::UserBaseEntity.find_by(id: action_log.extra.dig("extra", "user_id"))
end

def has_diff?
Expand Down
@@ -0,0 +1,25 @@
# frozen_string_literal: true

require "spec_helper"

describe Decidim::AdminLog::UserModerationPresenter, type: :helper do
context "with user" do
include_examples "present admin log entry" do
let(:reportable) { create(:user, :blocked, organization:) }
let(:moderation) { create(:user_moderation, user: reportable) }
let(:admin_log_resource) { reportable }
let(:admin_log_extra_data) { { extra: { user_id: reportable.id } } }
let(:action) { "report" }
end
end

context "with user group" do
include_examples "present admin log entry" do
let(:reportable) { create(:user_group, :blocked, organization:) }
let(:moderation) { create(:user_moderation, user: reportable) }
let(:admin_log_resource) { reportable }
let(:admin_log_extra_data) { { extra: { user_id: reportable.id } } }
let(:action) { "report" }
end
end
end

0 comments on commit b7422d2

Please sign in to comment.