user_callouts_helper.rb 779 Bytes
Newer Older
1 2
# frozen_string_literal: true

Matija Čupić's avatar
Matija Čupić committed
3
module UserCalloutsHelper
4
  GKE_CLUSTER_INTEGRATION = 'gke_cluster_integration'.freeze
5
  GCP_SIGNUP_OFFER = 'gcp_signup_offer'.freeze
6 7

  def show_gke_cluster_integration_callout?(project)
8 9
    can?(current_user, :create_cluster, project) &&
      !user_dismissed?(GKE_CLUSTER_INTEGRATION)
Matija Čupić's avatar
Matija Čupić committed
10 11
  end

12 13 14 15
  def show_gcp_signup_offer?
    !user_dismissed?(GCP_SIGNUP_OFFER)
  end

16 17 18 19
  def render_flash_user_callout(flash_type, message, feature_name)
    render 'shared/flash_user_callout', flash_type: flash_type, message: message, feature_name: feature_name
  end

20 21 22
  def render_dashboard_gold_trial(user)
  end

Matija Čupić's avatar
Matija Čupić committed
23 24 25
  private

  def user_dismissed?(feature_name)
Eric Eastwood's avatar
Eric Eastwood committed
26
    current_user&.callouts&.find_by(feature_name: UserCallout.feature_names[feature_name])
Matija Čupić's avatar
Matija Čupić committed
27 28
  end
end