mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-28 18:22:24 -05:00
[feature] Outgoing federation of avatar/header descriptions (#4270)
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl> # Description This implementation is compatible with Iceshrimp.NET, Pleroma and Chuckya, which already support federated avatar/header descriptions. I will add support for incoming descriptions federation in this or another PR (depending on when this one gets merged). ## Checklist Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]` If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want). - [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md). - [ ] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat. - [x] I/we have not leveraged AI to create the proposed changes. - [x] I/we have performed a self-review of added code. - [x] I/we have written code that is legible and maintainable by others. - [ ] I/we have commented the added code, particularly in hard-to-understand areas. - [ ] I/we have made any necessary changes to documentation. - [ ] I/we have added tests that cover new code. - [x] I/we have run tests and they pass locally with the changes. - [x] I/we have run `go fmt ./...` and `golangci-lint run`. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4270 Co-authored-by: nicole mikołajczyk <git@mkljczk.pl> Co-committed-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
parent
a9b2d4ee35
commit
7d50aec6dc
4 changed files with 28 additions and 2 deletions
|
|
@ -43,8 +43,8 @@ func (suite *DereferenceTestSuite) TestDerefLocalUser() {
|
|||
defer resp.Body.Close()
|
||||
|
||||
suite.Equal(http.StatusOK, resp.StatusCode)
|
||||
suite.EqualValues(1887, resp.ContentLength)
|
||||
suite.Equal("1887", resp.Header.Get("Content-Length"))
|
||||
suite.EqualValues(2007, resp.ContentLength)
|
||||
suite.Equal("2007", resp.Header.Get("Content-Length"))
|
||||
suite.Equal(apiutil.AppActivityLDJSON, resp.Header.Get("Content-Type"))
|
||||
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
|
|
@ -77,12 +77,14 @@ func (suite *DereferenceTestSuite) TestDerefLocalUser() {
|
|||
"following": "http://localhost:8080/users/the_mighty_zork/following",
|
||||
"icon": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "a green goblin looking nasty",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg"
|
||||
},
|
||||
"id": "http://localhost:8080/users/the_mighty_zork",
|
||||
"image": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "A very old-school screenshot of the original team fortress mod for quake",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -348,6 +348,12 @@ func (c *Converter) AccountToAS(
|
|||
avatarURLProperty.AppendIRI(avatarURL)
|
||||
iconImage.SetActivityStreamsUrl(avatarURLProperty)
|
||||
|
||||
if a.AvatarMediaAttachment.Description != "" {
|
||||
nameProp := streams.NewActivityStreamsNameProperty()
|
||||
nameProp.AppendXMLSchemaString(a.AvatarMediaAttachment.Description)
|
||||
iconImage.SetActivityStreamsName(nameProp)
|
||||
}
|
||||
|
||||
iconProperty.AppendActivityStreamsImage(iconImage)
|
||||
accountable.SetActivityStreamsIcon(iconProperty)
|
||||
}
|
||||
|
|
@ -382,6 +388,12 @@ func (c *Converter) AccountToAS(
|
|||
headerURLProperty.AppendIRI(headerURL)
|
||||
headerImage.SetActivityStreamsUrl(headerURLProperty)
|
||||
|
||||
if a.HeaderMediaAttachment.Description != "" {
|
||||
nameProp := streams.NewActivityStreamsNameProperty()
|
||||
nameProp.AppendXMLSchemaString(a.HeaderMediaAttachment.Description)
|
||||
headerImage.SetActivityStreamsName(nameProp)
|
||||
}
|
||||
|
||||
headerProperty.AppendActivityStreamsImage(headerImage)
|
||||
accountable.SetActivityStreamsImage(headerProperty)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,12 +66,14 @@ func (suite *InternalToASTestSuite) TestAccountToAS() {
|
|||
"following": "http://localhost:8080/users/the_mighty_zork/following",
|
||||
"icon": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "a green goblin looking nasty",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg"
|
||||
},
|
||||
"id": "http://localhost:8080/users/the_mighty_zork",
|
||||
"image": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "A very old-school screenshot of the original team fortress mod for quake",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg"
|
||||
},
|
||||
|
|
@ -132,12 +134,14 @@ func (suite *InternalToASTestSuite) TestAccountToASBot() {
|
|||
"following": "http://localhost:8080/users/the_mighty_zork/following",
|
||||
"icon": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "a green goblin looking nasty",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg"
|
||||
},
|
||||
"id": "http://localhost:8080/users/the_mighty_zork",
|
||||
"image": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "A very old-school screenshot of the original team fortress mod for quake",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg"
|
||||
},
|
||||
|
|
@ -278,12 +282,14 @@ func (suite *InternalToASTestSuite) TestAccountToASAliasedAndMoved() {
|
|||
"following": "http://localhost:8080/users/the_mighty_zork/following",
|
||||
"icon": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "a green goblin looking nasty",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg"
|
||||
},
|
||||
"id": "http://localhost:8080/users/the_mighty_zork",
|
||||
"image": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "A very old-school screenshot of the original team fortress mod for quake",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg"
|
||||
},
|
||||
|
|
@ -403,12 +409,14 @@ func (suite *InternalToASTestSuite) TestAccountToASWithEmoji() {
|
|||
"following": "http://localhost:8080/users/the_mighty_zork/following",
|
||||
"icon": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "a green goblin looking nasty",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg"
|
||||
},
|
||||
"id": "http://localhost:8080/users/the_mighty_zork",
|
||||
"image": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "A very old-school screenshot of the original team fortress mod for quake",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg"
|
||||
},
|
||||
|
|
@ -478,12 +486,14 @@ func (suite *InternalToASTestSuite) TestAccountToASWithSharedInbox() {
|
|||
"following": "http://localhost:8080/users/the_mighty_zork/following",
|
||||
"icon": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "a green goblin looking nasty",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg"
|
||||
},
|
||||
"id": "http://localhost:8080/users/the_mighty_zork",
|
||||
"image": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "A very old-school screenshot of the original team fortress mod for quake",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -200,12 +200,14 @@ func (suite *WrapTestSuite) TestWrapAccountableInUpdate() {
|
|||
"following": "http://localhost:8080/users/the_mighty_zork/following",
|
||||
"icon": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "a green goblin looking nasty",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg"
|
||||
},
|
||||
"id": "http://localhost:8080/users/the_mighty_zork",
|
||||
"image": {
|
||||
"mediaType": "image/jpeg",
|
||||
"name": "A very old-school screenshot of the original team fortress mod for quake",
|
||||
"type": "Image",
|
||||
"url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue