2020-04-20 14:03:57 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module User::RelationshipMethods
|
|
|
|
include CursorPaginatable
|
|
|
|
|
2022-06-18 08:29:23 -07:00
|
|
|
define_cursor_paginator :cursored_following_relationships, :ordered_following_relationships
|
|
|
|
define_cursor_paginator :cursored_follower_relationships, :ordered_follower_relationships
|
2020-04-20 14:03:57 -07:00
|
|
|
|
2023-01-28 12:17:25 -08:00
|
|
|
# @return [ActiveRecord::Relation<Relationships::Follow>] List of the user's following relationships
|
2022-06-18 08:29:23 -07:00
|
|
|
def ordered_following_relationships
|
|
|
|
active_follow_relationships.reverse_order.includes(target: [:profile])
|
|
|
|
end
|
|
|
|
|
2023-01-28 12:17:25 -08:00
|
|
|
# @return [ActiveRecord::Relation<Relationships::Follow>] List of the user's follower relationships
|
2022-06-18 08:29:23 -07:00
|
|
|
def ordered_follower_relationships
|
|
|
|
passive_follow_relationships.reverse_order.includes(source: [:profile])
|
|
|
|
end
|
2020-04-20 14:03:57 -07:00
|
|
|
end
|