Module: NewsmastMastodon::Concerns::PublicFeedConcern

Extended by:
ActiveSupport::Concern
Includes:
Redisable
Defined in:
app/models/newsmast_mastodon/concerns/public_feed_concern.rb

Instance Method Summary collapse

Instance Method Details

#get(limit, max_id = nil, since_id = nil, min_id = nil) ⇒ Array<Status>

Parameters:

  • limit (Integer)
  • max_id (Integer) (defaults to: nil)
  • since_id (Integer) (defaults to: nil)
  • min_id (Integer) (defaults to: nil)

Returns:

  • (Array<Status>)


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/newsmast_mastodon/concerns/public_feed_concern.rb', line 28

def get(limit, max_id = nil, since_id = nil, min_id = nil)
  # Honour host's feed-access settings (local_live_feed_access /
  # remote_live_feed_access for PublicFeed; local_topic_feed_access /
  # remote_topic_feed_access for TagFeed via inheritance).
  return [] if incompatible_feed_settings?

  scope = public_scope

  scope.merge!(without_replies_scope) unless with_replies?
  scope.merge!(without_reblogs_scope) unless with_reblogs? || ENV['LOCAL_DOMAIN'] == 'thebristolcable.social'
  scope.merge!(local_only_scope)  if local_only?
  scope.merge!(remote_only_scope) if remote_only?
  scope.merge!() if account?
  scope.merge!(media_only_scope) if media_only?
  scope.merge!(grouped_admin_statuses_scope)            if grouped_admin_statuses?
  scope.merge!(grouped_admin_reblogged_statuses_scope)  if grouped_admin_statuses?
  scope.merge!(language_scope) if &.chosen_languages.present?
  scope = apply_filters(scope)
  scope.to_a_paginated_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
end

#initialize(account, options = {}) ⇒ Object

Parameters:

  • account (Account)
  • options (Hash) (defaults to: {})
  • [Boolean] (Hash)

    a customizable set of options



18
19
20
21
# File 'app/models/newsmast_mastodon/concerns/public_feed_concern.rb', line 18

def initialize(, options = {})
  @account = 
  @options = options
end