Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `README.md`: Upstream added some text, but our README is completely different. Kept our README unchanged.
This commit is contained in:
@@ -9,6 +9,7 @@ class REST::Admin::AccountSerializer < ActiveModel::Serializer
|
||||
attribute :created_by_application_id, if: :created_by_application?
|
||||
attribute :invited_by_account_id, if: :invited?
|
||||
|
||||
has_many :ips, serializer: REST::Admin::IpSerializer
|
||||
has_one :account, serializer: REST::AccountSerializer
|
||||
|
||||
def id
|
||||
@@ -19,10 +20,6 @@ class REST::Admin::AccountSerializer < ActiveModel::Serializer
|
||||
object.user_email
|
||||
end
|
||||
|
||||
def ip
|
||||
object.user_current_sign_in_ip.to_s.presence
|
||||
end
|
||||
|
||||
def role
|
||||
object.user_role
|
||||
end
|
||||
@@ -74,4 +71,12 @@ class REST::Admin::AccountSerializer < ActiveModel::Serializer
|
||||
def created_by_application?
|
||||
object.user&.created_by_application_id&.present?
|
||||
end
|
||||
|
||||
def ips
|
||||
object.user&.ips
|
||||
end
|
||||
|
||||
def ip
|
||||
ips&.first
|
||||
end
|
||||
end
|
||||
|
5
app/serializers/rest/admin/ip_serializer.rb
Normal file
5
app/serializers/rest/admin/ip_serializer.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::Admin::IpSerializer < ActiveModel::Serializer
|
||||
attributes :ip, :used_at
|
||||
end
|
Reference in New Issue
Block a user