[backend/masto-client] Return profile fields in /accounts/verify_credentials
This commit is contained in:
parent
0414c791e6
commit
ec6a3f5e73
2 changed files with 11 additions and 7 deletions
|
@ -36,6 +36,10 @@ public class UserRenderer(IOptions<Config.InstanceSection> config, MfmConverter
|
|||
.AwaitAllAsync()
|
||||
: null;
|
||||
|
||||
var fieldsSource = source
|
||||
? profile?.Fields.Select(p => new Field { Name = p.Name, Value = p.Value }).ToList() ?? []
|
||||
: [];
|
||||
|
||||
var res = new AccountEntity
|
||||
{
|
||||
Id = user.Id,
|
||||
|
@ -66,7 +70,7 @@ public class UserRenderer(IOptions<Config.InstanceSection> config, MfmConverter
|
|||
//TODO: populate these
|
||||
res.Source = new AccountSource
|
||||
{
|
||||
Fields = [],
|
||||
Fields = fieldsSource,
|
||||
Language = "",
|
||||
Note = profile?.Description ?? "",
|
||||
Privacy = StatusEntity.EncodeVisibility(user.UserSettings?.DefaultNoteVisibility ??
|
||||
|
@ -105,7 +109,7 @@ public class UserRenderer(IOptions<Config.InstanceSection> config, MfmConverter
|
|||
{
|
||||
var userList = users.ToList();
|
||||
if (userList.Count == 0) return [];
|
||||
var emoji = await GetEmoji(userList);
|
||||
var emoji = await GetEmoji(userList);
|
||||
return await userList.Select(p => RenderAsync(p, emoji)).AwaitAllAsync();
|
||||
}
|
||||
}
|
|
@ -38,9 +38,9 @@ public class Field
|
|||
|
||||
public class AccountSource
|
||||
{
|
||||
[J("language")] public required string Language { get; set; }
|
||||
[J("note")] public required string Note { get; set; }
|
||||
[J("privacy")] public required string Privacy { get; set; }
|
||||
[J("sensitive")] public required bool Sensitive { get; set; }
|
||||
[J("fields")] public required Field[] Fields { get; set; }
|
||||
[J("language")] public required string Language { get; set; }
|
||||
[J("note")] public required string Note { get; set; }
|
||||
[J("privacy")] public required string Privacy { get; set; }
|
||||
[J("sensitive")] public required bool Sensitive { get; set; }
|
||||
[J("fields")] public required List<Field> Fields { get; set; }
|
||||
}
|
Loading…
Add table
Reference in a new issue