use Ecto.Schema
import Ecto.Changeset
+ alias Pleroma.User.Info
+
embedded_schema do
field(:banner, :map, default: %{})
field(:background, :map, default: %{})
cast(info, params, [:pinned_activities])
end
+
+ def roles(%Info{is_moderator: is_moderator, is_admin: is_admin}) do
+ %{
+ admin: is_admin,
+ moderator: is_moderator
+ }
+ end
end
%{
"deactivated" => admin.info.deactivated,
"id" => admin.id,
- "nickname" => admin.nickname
+ "nickname" => admin.nickname,
+ "roles" => %{"admin" => true, "moderator" => false}
},
%{
"deactivated" => user.info.deactivated,
"id" => user.id,
- "nickname" => user.nickname
+ "nickname" => user.nickname,
+ "roles" => %{"admin" => false, "moderator" => false}
}
]
}
%{
"deactivated" => user.info.deactivated,
"id" => user.id,
- "nickname" => user.nickname
+ "nickname" => user.nickname,
+ "roles" => %{"admin" => false, "moderator" => false}
}
]
}
%{
"deactivated" => user.info.deactivated,
"id" => user.id,
- "nickname" => user.nickname
+ "nickname" => user.nickname,
+ "roles" => %{"admin" => false, "moderator" => false}
}
]
}
%{
"deactivated" => user2.info.deactivated,
"id" => user2.id,
- "nickname" => user2.nickname
+ "nickname" => user2.nickname,
+ "roles" => %{"admin" => false, "moderator" => false}
}
]
}
%{
"deactivated" => user.info.deactivated,
"id" => user.id,
- "nickname" => user.nickname
+ "nickname" => user.nickname,
+ "roles" => %{"admin" => false, "moderator" => false}
}
]
}
%{
"deactivated" => admin.info.deactivated,
"id" => admin.id,
- "nickname" => admin.nickname
+ "nickname" => admin.nickname,
+ "roles" => %{"admin" => true, "moderator" => false}
},
%{
"deactivated" => user.info.deactivated,
"id" => user.id,
- "nickname" => user.nickname
+ "nickname" => user.nickname,
+ "roles" => %{"admin" => false, "moderator" => false}
}
]
}
%{
"deactivated" => !user.info.deactivated,
"id" => user.id,
- "nickname" => user.nickname
+ "nickname" => user.nickname,
+ "roles" => %{"admin" => false, "moderator" => false}
}
end
end