diff --git a/app/assets/javascripts/.eslintrc.js b/app/assets/javascripts/.eslintrc.js
index e5019c433cc72..c4522c82dca44 100644
--- a/app/assets/javascripts/.eslintrc.js
+++ b/app/assets/javascripts/.eslintrc.js
@@ -26,7 +26,6 @@ module.exports = {
initializeBaseUserData: false,
initializeDisplayAdVisibility: false,
initializeReadingListIcons: false,
- initializeSponsorshipVisibility: false,
ActiveXObject: false,
AndroidBridge: false,
},
diff --git a/app/assets/javascripts/initializePage.js b/app/assets/javascripts/initializePage.js
index 371059e77b174..fb2bc01612df9 100644
--- a/app/assets/javascripts/initializePage.js
+++ b/app/assets/javascripts/initializePage.js
@@ -49,7 +49,6 @@ function initializePage() {
}
initializeBroadcast();
initializeReadingListIcons();
- initializeSponsorshipVisibility();
initializeDisplayAdVisibility();
if (document.getElementById('sidebar-additional')) {
document.getElementById('sidebar-additional').classList.add('showing');
diff --git a/app/assets/javascripts/initializers/initializeLocalStorageRender.js b/app/assets/javascripts/initializers/initializeLocalStorageRender.js
index 0e67055b8257c..6fd41fead0866 100644
--- a/app/assets/javascripts/initializers/initializeLocalStorageRender.js
+++ b/app/assets/javascripts/initializers/initializeLocalStorageRender.js
@@ -6,7 +6,6 @@ function initializeLocalStorageRender() {
initializeBaseUserData();
initializeReadingListIcons();
initializeDisplayAdVisibility();
- initializeSponsorshipVisibility();
}
} catch (err) {
browserStoreCache('remove');
diff --git a/app/assets/javascripts/initializers/initializeSponsorshipVisibility.js b/app/assets/javascripts/initializers/initializeSponsorshipVisibility.js
deleted file mode 100644
index b3c799d8bc57d..0000000000000
--- a/app/assets/javascripts/initializers/initializeSponsorshipVisibility.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * kept as a stand function so it can be loaded again without issue
- * see: https://github.com/forem/forem/issues/6468
- */
-function sponsorClickHandler(event) {
- ga(
- 'send',
- 'event',
- 'click',
- 'click sponsor link',
- event.target.dataset.details,
- null,
- );
-}
-
-function sponsorClickHandlerGA4(event) {
- gtag('event', 'click sponsor link', {
- event_category: 'click',
- event_label: event.target.dataset.details,
- });
-}
-
-function listenForSponsorClick() {
- setTimeout(() => {
- if (window.ga || window.gtag) {
- var links = document.getElementsByClassName('partner-link');
- // eslint-disable-next-line no-plusplus
- for (var i = 0; i < links.length; i++) {
- if (window.ga) {
- links[i].onclick = sponsorClickHandler;
- }
- if (window.gtag) {
- links[i].onclick = sponsorClickHandlerGA4;
- }
- }
- }
- }, 400);
-}
-
-function initializeSponsorshipVisibility() {
- var el =
- document.getElementById('sponsorship-widget') ||
- document.getElementById('partner-content-display');
- var user = userData();
- if (el) {
- setTimeout(() => {
- if (document.querySelectorAll('[data-partner-seen]').length === 0) {
- if (window.ga) {
- ga(
- 'send',
- 'event',
- 'view',
- 'sponsor displayed on page',
- el.dataset.details,
- null,
- );
- }
- if (window.gtag) {
- gtag('event', 'sponsor displayed on page', {
- event_category: 'view',
- event_label: el.dataset.details,
- });
- }
- el.dataset.partnerSeen = 'true';
- }
- }, 400);
- }
- if (el && user && user.display_sponsors) {
- el.classList.remove('hidden');
- listenForSponsorClick();
- } else if (el && user) {
- el.classList.add('hidden');
- } else if (el) {
- el.classList.remove('hidden');
- listenForSponsorClick();
- }
-}
diff --git a/app/assets/stylesheets/views.scss b/app/assets/stylesheets/views.scss
index ade82102f0b8f..7e77c66ba49ad 100644
--- a/app/assets/stylesheets/views.scss
+++ b/app/assets/stylesheets/views.scss
@@ -10,4 +10,3 @@
@import 'views/mod-center';
@import 'views/signin';
@import 'views/signup-modal';
-@import 'views/sponsors';
diff --git a/app/assets/stylesheets/views/sponsors.scss b/app/assets/stylesheets/views/sponsors.scss
deleted file mode 100644
index b696af27a6288..0000000000000
--- a/app/assets/stylesheets/views/sponsors.scss
+++ /dev/null
@@ -1,44 +0,0 @@
-@import '../config/import';
-
-.sponsors {
- display: block;
- margin-bottom: var(--su-6);
-
- @media (min-width: $breakpoint-m) {
- display: grid;
- grid-template-columns: 33% 1fr;
- grid-gap: var(--su-4);
- }
-
- @media (min-width: $breakpoint-l) {
- grid-template-columns: 25% 1fr;
- grid-gap: var(--su-6);
- }
-
- &__label {
- background: var(--base-0);
- padding: var(--su-4);
- border-radius: var(--radius);
- margin-bottom: var(--su-4);
-
- @media (min-width: $breakpoint-m) {
- margin-bottom: 0;
- }
- }
-
- &__items {
- display: grid;
- grid-gap: var(--su-6);
- }
-
- &__logo {
- border-radius: var(--radius);
- background: white;
- padding: var(--su-4);
- margin-bottom: var(--su-4);
- max-width: 250px;
- height: auto;
- display: block;
- border: 1px solid var(--base-20);
- }
-}
diff --git a/app/controllers/admin/sponsorships_controller.rb b/app/controllers/admin/sponsorships_controller.rb
deleted file mode 100644
index 31dc28091e2be..0000000000000
--- a/app/controllers/admin/sponsorships_controller.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-module Admin
- class SponsorshipsController < Admin::ApplicationController
- layout "admin"
-
- def index
- @sponsorships = Sponsorship.includes(:organization, :user, :sponsorable)
- .order(created_at: :desc)
- .page(params[:page]).per(50)
-
- return if params[:status].blank?
-
- @sponsorships = @sponsorships.where(status: params[:status])
- end
-
- def new
- @sponsorship = Sponsorship.new
- end
-
- def edit
- @sponsorship = Sponsorship.find(params[:id])
- end
-
- def create
- @sponsorship = Sponsorship.new(sponsorship_params)
-
- if @sponsorship.save
- flash[:success] = I18n.t("admin.sponsorships_controller.created")
- redirect_to admin_sponsorships_path
- else
- flash[:danger] = @sponsorship.errors_as_sentence
- render :new
- end
- end
-
- def update
- @sponsorship = Sponsorship.find(params[:id])
- if @sponsorship.update(sponsorship_params)
- flash[:notice] = I18n.t("admin.sponsorships_controller.updated")
- redirect_to admin_sponsorships_path
- else
- flash[:danger] = @sponsorship.errors_as_sentence
- render action: :edit
- end
- end
-
- def destroy
- @sponsorship = Sponsorship.find(params[:id])
- if @sponsorship.destroy
- flash[:notice] = I18n.t("admin.sponsorships_controller.destroyed")
- else
- flash[:danger] = I18n.t("admin.sponsorships_controller.not_destroyed")
- end
- redirect_to admin_sponsorships_path
- end
-
- private
-
- def sponsorship_params
- strong_params = params.fetch(:sponsorship, {})
- .permit(:status, :expires_at, :tagline, :url,
- :blurb_html, :featured_number,
- :instructions, :level, :user_id,
- :sponsorable_id, :sponsorable_type,
- :organization_id, :instructions_updated_at)
-
- if strong_params[:sponsorable_id].try(:empty?) || strong_params[:sponsorable_type].try(:empty?)
- # Clear sponsorable & sponsorable_type if they were left empty
- strong_params.delete("sponsorable_id")
- strong_params.delete("sponsorable_type")
- end
- strong_params
- end
- end
-end
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 5217591f71938..d04503014134e 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -51,7 +51,7 @@ def update
flash[:success] = I18n.t("tags_controller.tag_successfully_updated")
redirect_to "#{URL.tag_path(@tag)}/edit"
else
- flash[:error] = @tag.errors.full_messages
+ flash.now[:error] = @tag.errors.full_messages
render :edit
end
end
@@ -80,7 +80,7 @@ def suggest
private
def tags
- @tags ||= Tag.direct.includes(:sponsorship).limit(100)
+ @tags ||= Tag.direct.order("hotness_score DESC").limit(100)
end
def convert_empty_string_to_nil
diff --git a/app/decorators/sponsorship_decorator.rb b/app/decorators/sponsorship_decorator.rb
deleted file mode 100644
index 2cd5bfba35f0f..0000000000000
--- a/app/decorators/sponsorship_decorator.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class SponsorshipDecorator < ApplicationDecorator
- def level_background_color
- hexes = {
- "gold" => "linear-gradient(to right, #faf0e6 8%, #faf3e6 18%, #fcf6eb 33%);",
- "silver" => "linear-gradient(to right, #e3e3e3 8%, #f0eded 18%, #e8e8e8 33%);",
- "bronze" => "linear-gradient(to right, #ebe2d3 8%, #f5eee1 18%, #ede6d8 33%);"
- }
-
- hexes[level].to_s
- end
-end
diff --git a/app/lib/constants/settings/general.rb b/app/lib/constants/settings/general.rb
index 6a74eeccf19cd..3f756a803183b 100644
--- a/app/lib/constants/settings/general.rb
+++ b/app/lib/constants/settings/general.rb
@@ -99,10 +99,6 @@ def self.details
description: I18n.t("lib.constants.settings.general.sidebar.description"),
placeholder: I18n.t("lib.constants.settings.general.sidebar.placeholder")
},
- sponsor_headline: {
- description: I18n.t("lib.constants.settings.general.sponsor.description"),
- placeholder: I18n.t("lib.constants.settings.general.sponsor.placeholder")
- },
stripe_api_key: {
description: I18n.t("lib.constants.settings.general.stripe_api.description"),
placeholder: "sk_live_...."
diff --git a/app/models/admin_menu.rb b/app/models/admin_menu.rb
index 032a79b93b419..b3ddded4ae73a 100644
--- a/app/models/admin_menu.rb
+++ b/app/models/admin_menu.rb
@@ -46,7 +46,6 @@ class AdminMenu
scope :advanced, "flashlight-line", [
item(name: "broadcasts"),
item(name: "response templates"),
- item(name: "sponsorships"),
item(name: "developer tools", controller: "tools", children: [
item(name: "tools"),
item(name: "vault secrets", controller: "secrets"),
diff --git a/app/models/settings/general.rb b/app/models/settings/general.rb
index 2416f584ea996..8187e0ee4e1d3 100644
--- a/app/models/settings/general.rb
+++ b/app/models/settings/general.rb
@@ -93,9 +93,6 @@ class General < Base
}
setting :twitter_hashtag, type: :string
- # Sponsors
- setting :sponsor_headline, default: -> { I18n.t("models.settings.general.community_sponsors") }
-
# Tags
setting :sidebar_tags, type: :array, default: %w[]
diff --git a/app/services/slack/messengers/sponsorship.rb b/app/services/slack/messengers/sponsorship.rb
deleted file mode 100644
index cac149604d44b..0000000000000
--- a/app/services/slack/messengers/sponsorship.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-module Slack
- module Messengers
- class Sponsorship
- def initialize(user:, organization:, level:, tag: nil)
- @user = user
- @organization = organization
- @level = level
- @tag = tag
- end
-
- def self.call(...)
- new(...).call
- end
-
- def call
- type = tag.present? ? "##{tag.name}" : level
- message = I18n.t(
- "services.slack.messengers.sponsorship.body",
- user: user.username,
- type: type,
- organization: organization.username,
- )
-
- Slack::Messengers::Worker.perform_async(
- "message" => message,
- "channel" => "incoming-partners",
- "username" => "media_sponsor",
- "icon_emoji" => ":partyparrot:",
- )
- end
-
- private
-
- attr_reader :user, :organization, :level, :tag
- end
- end
-end
diff --git a/app/views/admin/settings/forms/_sponsors.html.erb b/app/views/admin/settings/forms/_sponsors.html.erb
deleted file mode 100644
index a71a023a21bc8..0000000000000
--- a/app/views/admin/settings/forms/_sponsors.html.erb
+++ /dev/null
@@ -1,20 +0,0 @@
-<%= form_for(Settings::General.new,
- url: admin_settings_general_settings_path,
- html: { data: { action: "submit->config#updateConfigurationSettings" } }) do |f| %>
- Sponsors
-
ID | -Level | -Status | -Expires At | -Sponsorable | -Created At | -Creator | -Organization | -Actions | -
---|---|---|---|---|---|---|---|---|
<%= link_to sponsorship.id, edit_admin_sponsorship_path(sponsorship) %> | -<%= sponsorship.level %> | -<%= sponsorship.status %> | -<%= sponsorship.expires_at&.strftime("%d %B %Y %H:%M UTC") %> | -- <% if sponsorship.sponsorable.is_a?(ActsAsTaggableOn::Tag) %> - <%= link_to sponsorship.sponsorable.name, "/t/#{sponsorship.sponsorable.name}" %> - <% end %> - | -<%= sponsorship.created_at.strftime("%d %B %Y %H:%M UTC") %> | -<%= link_to "@#{sponsorship.user.username}", "/#{sponsorship.user.username}" %> | -- <%= link_to "@#{sponsorship.organization.username}", "/#{sponsorship.organization.username}" %> - | -- <%= link_to "edit", edit_admin_sponsorship_path(sponsorship) %> - | -