mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-18 15:57:29 -06:00
little fix to visibility
This commit is contained in:
parent
eb9de53776
commit
72c91c92d0
2 changed files with 19 additions and 12 deletions
|
|
@ -804,6 +804,13 @@ func (ps *postgresService) StatusVisible(targetStatus *gtsmodel.Status, targetAc
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the requesting account is mentioned in the status it should always be visible
|
||||||
|
for _, acct := range relevantAccounts.MentionedAccounts {
|
||||||
|
if acct.ID == requestingAccount.ID {
|
||||||
|
return true, nil // yep it's mentioned!
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// at this point we know neither account blocks the other, or another account mentioned or otherwise referred to in the status
|
// at this point we know neither account blocks the other, or another account mentioned or otherwise referred to in the status
|
||||||
|
|
@ -835,12 +842,6 @@ func (ps *postgresService) StatusVisible(targetStatus *gtsmodel.Status, targetAc
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
case gtsmodel.VisibilityDirect:
|
case gtsmodel.VisibilityDirect:
|
||||||
// make sure the requesting account is mentioned in the status
|
|
||||||
for _, acct := range relevantAccounts.MentionedAccounts {
|
|
||||||
if acct.ID == requestingAccount.ID {
|
|
||||||
return true, nil // yep it's mentioned!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
l.Debug("requesting account requests a status it's not mentioned in")
|
l.Debug("requesting account requests a status it's not mentioned in")
|
||||||
return false, nil // it's not mentioned -_-
|
return false, nil // it's not mentioned -_-
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,10 @@ func (p *processor) StatusFave(authed *oauth.Auth, targetStatusID string) (*apim
|
||||||
}
|
}
|
||||||
|
|
||||||
// is the status faveable?
|
// is the status faveable?
|
||||||
if !targetStatus.VisibilityAdvanced.Likeable {
|
if targetStatus.VisibilityAdvanced != nil {
|
||||||
return nil, errors.New("status is not faveable")
|
if !targetStatus.VisibilityAdvanced.Likeable {
|
||||||
|
return nil, errors.New("status is not faveable")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// it's visible! it's faveable! so let's fave the FUCK out of it
|
// it's visible! it's faveable! so let's fave the FUCK out of it
|
||||||
|
|
@ -236,8 +238,10 @@ func (p *processor) StatusBoost(authed *oauth.Auth, targetStatusID string) (*api
|
||||||
return nil, NewErrorNotFound(errors.New("status is not visible"))
|
return nil, NewErrorNotFound(errors.New("status is not visible"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !targetStatus.VisibilityAdvanced.Boostable {
|
if targetStatus.VisibilityAdvanced != nil {
|
||||||
return nil, NewErrorForbidden(errors.New("status is not boostable"))
|
if !targetStatus.VisibilityAdvanced.Boostable {
|
||||||
|
return nil, NewErrorForbidden(errors.New("status is not boostable"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// it's visible! it's boostable! so let's boost the FUCK out of it
|
// it's visible! it's boostable! so let's boost the FUCK out of it
|
||||||
|
|
@ -446,8 +450,10 @@ func (p *processor) StatusUnfave(authed *oauth.Auth, targetStatusID string) (*ap
|
||||||
}
|
}
|
||||||
|
|
||||||
// is the status faveable?
|
// is the status faveable?
|
||||||
if !targetStatus.VisibilityAdvanced.Likeable {
|
if targetStatus.VisibilityAdvanced != nil {
|
||||||
return nil, errors.New("status is not faveable")
|
if !targetStatus.VisibilityAdvanced.Likeable {
|
||||||
|
return nil, errors.New("status is not faveable")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// it's visible! it's faveable! so let's unfave the FUCK out of it
|
// it's visible! it's faveable! so let's unfave the FUCK out of it
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue