mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Parse funkwhale Album
as Statusable to allow barebones interacting with bandwagon (#3931)
* bump activity version * parse funkwhale / bandwagon album as statusable
This commit is contained in:
@@ -705,35 +705,38 @@ func (c *Converter) StatusToAS(ctx context.Context, s *gtsmodel.Status) (ap.Stat
|
||||
status.SetActivityStreamsSensitive(sensitiveProp)
|
||||
|
||||
// interactionPolicy
|
||||
var p *gtsmodel.InteractionPolicy
|
||||
if s.InteractionPolicy != nil {
|
||||
// Use InteractionPolicy
|
||||
// set on the status.
|
||||
p = s.InteractionPolicy
|
||||
} else {
|
||||
// Fall back to default policy
|
||||
// for the status's visibility.
|
||||
p = gtsmodel.DefaultInteractionPolicyFor(s.Visibility)
|
||||
}
|
||||
policy, err := c.InteractionPolicyToASInteractionPolicy(ctx, p, s)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating interactionPolicy: %w", err)
|
||||
}
|
||||
|
||||
policyProp := streams.NewGoToSocialInteractionPolicyProperty()
|
||||
policyProp.AppendGoToSocialInteractionPolicy(policy)
|
||||
status.SetGoToSocialInteractionPolicy(policyProp)
|
||||
|
||||
// Parse + set approvedBy.
|
||||
if s.ApprovedByURI != "" {
|
||||
approvedBy, err := url.Parse(s.ApprovedByURI)
|
||||
if ipa, ok := status.(ap.InteractionPolicyAware); ok {
|
||||
var p *gtsmodel.InteractionPolicy
|
||||
if s.InteractionPolicy != nil {
|
||||
// Use InteractionPolicy
|
||||
// set on the status.
|
||||
p = s.InteractionPolicy
|
||||
} else {
|
||||
// Fall back to default policy
|
||||
// for the status's visibility.
|
||||
p = gtsmodel.DefaultInteractionPolicyFor(s.Visibility)
|
||||
}
|
||||
policy, err := c.InteractionPolicyToASInteractionPolicy(ctx, p, s)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error parsing approvedBy: %w", err)
|
||||
return nil, fmt.Errorf("error creating interactionPolicy: %w", err)
|
||||
}
|
||||
|
||||
approvedByProp := streams.NewGoToSocialApprovedByProperty()
|
||||
approvedByProp.Set(approvedBy)
|
||||
status.SetGoToSocialApprovedBy(approvedByProp)
|
||||
// Set interaction policy.
|
||||
policyProp := streams.NewGoToSocialInteractionPolicyProperty()
|
||||
policyProp.AppendGoToSocialInteractionPolicy(policy)
|
||||
ipa.SetGoToSocialInteractionPolicy(policyProp)
|
||||
|
||||
// Parse + set approvedBy.
|
||||
if s.ApprovedByURI != "" {
|
||||
approvedBy, err := url.Parse(s.ApprovedByURI)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error parsing approvedBy: %w", err)
|
||||
}
|
||||
|
||||
approvedByProp := streams.NewGoToSocialApprovedByProperty()
|
||||
approvedByProp.Set(approvedBy)
|
||||
ipa.SetGoToSocialApprovedBy(approvedByProp)
|
||||
}
|
||||
}
|
||||
|
||||
return status, nil
|
||||
|
Reference in New Issue
Block a user