From b90bd24e3aea8805771b8302124535f9f709bbd8 Mon Sep 17 00:00:00 2001 From: Quentin Champenois <26109239+Quentinchampenois@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:50:44 +0100 Subject: [PATCH] revert: "fix: Disable author tooltip (#113)" (#116) This reverts commit 7639d0a4d53a11c29bbe0112b45310b6ae8e78ea. --- .../decidim/user_presenter_concern.rb | 13 -- config/application.rb | 1 - .../presenters/decidim/user_presenter_spec.rb | 141 ------------------ 3 files changed, 155 deletions(-) delete mode 100644 app/presenters/concerns/decidim/user_presenter_concern.rb delete mode 100644 spec/presenters/decidim/user_presenter_spec.rb diff --git a/app/presenters/concerns/decidim/user_presenter_concern.rb b/app/presenters/concerns/decidim/user_presenter_concern.rb deleted file mode 100644 index 3e34dd3..0000000 --- a/app/presenters/concerns/decidim/user_presenter_concern.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module Decidim - module UserPresenterConcern - extend ActiveSupport::Concern - - included do - def has_tooltip? - false - end - end - end -end diff --git a/config/application.rb b/config/application.rb index a5033f7..b3faeea 100644 --- a/config/application.rb +++ b/config/application.rb @@ -43,7 +43,6 @@ class Application < Rails::Application config.to_prepare do ActiveStorage::Blob.include ActiveStorage::Downloadable - Decidim::UserPresenter.include Decidim::UserPresenterConcern end config.after_initialize do diff --git a/spec/presenters/decidim/user_presenter_spec.rb b/spec/presenters/decidim/user_presenter_spec.rb deleted file mode 100644 index dd29216..0000000 --- a/spec/presenters/decidim/user_presenter_spec.rb +++ /dev/null @@ -1,141 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -module Decidim - describe UserPresenter, type: :helper do - let(:user) { build(:user) } - - describe "#nickname" do - subject { described_class.new(user).nickname } - - context "when not blocked" do - it { is_expected.to eq("@#{user.nickname}") } - end - - context "when blocked" do - before do - user.blocked = true - end - - it { is_expected.to eq("") } - end - end - - describe "#can_be_contacted?" do - subject { described_class.new(user).can_be_contacted? } - - context "when user is not blocked" do - it "can be contacted" do - expect(subject).to be(true) - end - end - - context "when user is blocked" do - it "cannot be contacted" do - user.blocked = true - - expect(subject).to be_nil - end - end - end - - describe "#profile_url" do - subject { described_class.new(user).profile_url } - - it { is_expected.to eq("http://#{user.organization.host}:#{Capybara.server_port}/profiles/#{user.nickname}") } - end - - describe "#default_avatar_url" do - subject { described_class.new(user).default_avatar_url } - - it { is_expected.to eq("//#{user.organization.host}:#{Capybara.server_port}#{ActionController::Base.helpers.asset_pack_path("media/images/default-avatar.svg")}") } - end - - context "when user is not officialized" do - describe "#badge" do - subject { described_class.new(user).badge } - - it { is_expected.to eq("") } - end - end - - context "when user is officialized" do - let(:user) { build(:user, :officialized) } - - describe "#badge" do - subject { described_class.new(user).badge } - - it { is_expected.to eq("verified-badge") } - end - end - - describe "#profile_path" do - subject { described_class.new(user).profile_path } - - it { is_expected.to eq("/profiles/#{user.nickname}") } - end - - context "when user is deleted" do - let(:user) { build(:user, :deleted) } - - describe "#profile_path" do - subject { described_class.new(user).profile_path } - - it { is_expected.to eq("") } - end - end - - describe "#display_mention" do - subject { described_class.new(user).display_mention } - - it do - expect(subject).to \ - have_link(user.nickname, href: "http://#{user.organization.host}:#{Capybara.server_port}/profiles/#{user.nickname}") & - have_selector(".user-mention") - end - end - - context "when user is a group" do - let(:user) { build(:user_group) } - - describe "#profile_path" do - subject { described_class.new(user).profile_path } - - it { is_expected.to eq("/profiles/#{user.nickname}") } - end - - describe "#profile_url" do - subject { described_class.new(user).profile_url } - - let(:host) { user.organization.host } - - it { is_expected.to eq("http://#{host}:#{Capybara.server_port}/profiles/#{user.nickname}") } - end - - describe "#can_be_contacted?" do - subject { described_class.new(user).can_be_contacted? } - - context "when group is not blocked" do - it "can be contacted" do - expect(subject).to be(true) - end - end - - context "when group is blocked" do - it "cannot be contacted" do - user.blocked = true - - expect(subject).to be_nil - end - end - end - - describe "#has_tooltip?" do - subject { described_class.new(user).has_tooltip? } - - it { is_expected.to be_falsey } - end - end - end -end