[backend/federation] Add JsonIgnore attributes to internal properties to prevent them from being written to the job table unnecessarily
This commit is contained in:
parent
19c9b7bf90
commit
0c59081aee
4 changed files with 9 additions and 4 deletions
|
@ -3,6 +3,7 @@ using Iceshrimp.Backend.Core.Configuration;
|
||||||
using Iceshrimp.Backend.Core.Extensions;
|
using Iceshrimp.Backend.Core.Extensions;
|
||||||
using J = Newtonsoft.Json.JsonPropertyAttribute;
|
using J = Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
using JC = Newtonsoft.Json.JsonConverterAttribute;
|
using JC = Newtonsoft.Json.JsonConverterAttribute;
|
||||||
|
using JI = Newtonsoft.Json.JsonIgnoreAttribute;
|
||||||
using VC = Iceshrimp.Backend.Core.Federation.ActivityStreams.Types.ValueObjectConverter;
|
using VC = Iceshrimp.Backend.Core.Federation.ActivityStreams.Types.ValueObjectConverter;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
|
namespace Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
|
||||||
|
@ -125,7 +126,7 @@ public class ASActor : ASObject
|
||||||
[JC(typeof(ASAttachmentConverter))]
|
[JC(typeof(ASAttachmentConverter))]
|
||||||
public List<ASAttachment>? Attachments { get; set; }
|
public List<ASAttachment>? Attachments { get; set; }
|
||||||
|
|
||||||
public bool IsBot => Type == $"{Constants.ActivityStreamsNs}#Service";
|
[JI] public bool IsBot => Type == $"{Constants.ActivityStreamsNs}#Service";
|
||||||
|
|
||||||
public void Normalize(string uri, string acct)
|
public void Normalize(string uri, string acct)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using Iceshrimp.Backend.Core.Configuration;
|
using Iceshrimp.Backend.Core.Configuration;
|
||||||
using J = Newtonsoft.Json.JsonPropertyAttribute;
|
using J = Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
using JC = Newtonsoft.Json.JsonConverterAttribute;
|
using JC = Newtonsoft.Json.JsonConverterAttribute;
|
||||||
|
using JI = Newtonsoft.Json.JsonIgnoreAttribute;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
|
namespace Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ public class ASLink(string url) : ASObjectBase(url)
|
||||||
[JC(typeof(ValueObjectConverter))]
|
[JC(typeof(ValueObjectConverter))]
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
public string? Link => Id ?? Href?.Id;
|
[JI] public string? Link => Id ?? Href?.Id;
|
||||||
public override string? ToString() => Link;
|
public override string? ToString() => Link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ using Iceshrimp.Backend.Core.Configuration;
|
||||||
using Iceshrimp.Backend.Core.Database.Tables;
|
using Iceshrimp.Backend.Core.Database.Tables;
|
||||||
using J = Newtonsoft.Json.JsonPropertyAttribute;
|
using J = Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
using JC = Newtonsoft.Json.JsonConverterAttribute;
|
using JC = Newtonsoft.Json.JsonConverterAttribute;
|
||||||
|
using JI = Newtonsoft.Json.JsonIgnoreAttribute;
|
||||||
using VC = Iceshrimp.Backend.Core.Federation.ActivityStreams.Types.ValueObjectConverter;
|
using VC = Iceshrimp.Backend.Core.Federation.ActivityStreams.Types.ValueObjectConverter;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
|
namespace Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
|
||||||
|
@ -10,7 +11,8 @@ public class ASNote : ASObject
|
||||||
{
|
{
|
||||||
public ASNote(bool withType = true) => Type = withType ? Types.Note : null;
|
public ASNote(bool withType = true) => Type = withType ? Types.Note : null;
|
||||||
|
|
||||||
public bool VerifiedFetch = false;
|
[JI] public bool VerifiedFetch = false;
|
||||||
|
|
||||||
private string? _mkContent;
|
private string? _mkContent;
|
||||||
|
|
||||||
[J("https://misskey-hub.net/ns#_misskey_content")]
|
[J("https://misskey-hub.net/ns#_misskey_content")]
|
||||||
|
|
|
@ -4,6 +4,7 @@ using Newtonsoft.Json.Linq;
|
||||||
using J = Newtonsoft.Json.JsonPropertyAttribute;
|
using J = Newtonsoft.Json.JsonPropertyAttribute;
|
||||||
using JC = Newtonsoft.Json.JsonConverterAttribute;
|
using JC = Newtonsoft.Json.JsonConverterAttribute;
|
||||||
using JR = Newtonsoft.Json.JsonRequiredAttribute;
|
using JR = Newtonsoft.Json.JsonRequiredAttribute;
|
||||||
|
using JI = Newtonsoft.Json.JsonIgnoreAttribute;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
|
namespace Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ public class ASObject : ASObjectBase
|
||||||
[JC(typeof(StringListSingleConverter))]
|
[JC(typeof(StringListSingleConverter))]
|
||||||
public string? Type { get; set; }
|
public string? Type { get; set; }
|
||||||
|
|
||||||
[JsonIgnore] public bool IsUnresolved => GetType() == typeof(ASObject) && Type == null;
|
[JI] public bool IsUnresolved => GetType() == typeof(ASObject) && Type == null;
|
||||||
|
|
||||||
//FIXME: don't recurse creates and co
|
//FIXME: don't recurse creates and co
|
||||||
public static ASObject? Deserialize(JToken token)
|
public static ASObject? Deserialize(JToken token)
|
||||||
|
|
Loading…
Add table
Reference in a new issue