Class: Graphql::Dashboard::Subscriptions::SubscriptionsController

Inherits:
BaseController show all
Defined in:
lib/graphql/dashboard/subscriptions.rb

Constant Summary

Constants inherited from BaseController

BaseController::INSTALLABLE_COMPONENT_HEADER_HTML, BaseController::INSTALLABLE_COMPONENT_MESSAGE_HTML

Instance Method Summary collapse

Methods inherited from BaseController

#feature_installed?

Methods included from Installable

#check_installed, #feature_installed?

Methods inherited from ApplicationController

#schema_class

Instance Method Details

#clear_allObject



88
89
90
91
92
# File 'lib/graphql/dashboard/subscriptions.rb', line 88

def clear_all
  schema_class.subscriptions.clear
  flash[:success] = "All subscription data cleared."
  head :no_content
end

#showObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/graphql/dashboard/subscriptions.rb', line 68

def show
  subscription_id = params[:id]
  subscriptions = schema_class.subscriptions
  query_data = subscriptions.read_subscription(subscription_id)
  is_broadcast = subscriptions.broadcast_subscription_id?(subscription_id)

  if is_broadcast && subscriptions.show_broadcast_subscribers_count?
    subscribers_count = subscriptions.count_broadcast_subscribed(subscription_id)
    is_still_subscribed = subscribers_count > 0
  else
    subscribers_count = nil
    is_still_subscribed = subscriptions.still_subscribed?(subscription_id)
  end

  @query_data = query_data
  @still_subscribed = is_still_subscribed
  @is_broadcast = is_broadcast
  @subscribers_count = subscribers_count
end