Skip to content

Commit

Permalink
Fix tags url in tags array
Browse files Browse the repository at this point in the history
  • Loading branch information
mczachurski committed Sep 25, 2024
1 parent 9ef1491 commit cf163e6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ struct ActivityPubActorsController {
/// "summary": "#iOS/#dotNET developer, #Apple  fanboy, 📷 aspiring photographer",
/// "tag": [
/// {
/// "href": "https://example.com/hashtag/Apple",
/// "href": "https://example.com/tags/Apple",
/// "name": "Apple",
/// "type": "Hashtag"
/// },
/// {
/// "href": "https://example.com/hashtag/dotNET",
/// "href": "https://example.com/tags/dotNET",
/// "name": "dotNET",
/// "type": "Hashtag"
/// },
/// {
/// "href": "https://example.com/hashtag/iOS",
/// "href": "https://example.com/tags/iOS",
/// "name": "iOS",
/// "type": "Hashtag"
/// }
Expand Down Expand Up @@ -178,7 +178,7 @@ struct ActivityPubActorsController {
endpoints: PersonEndpointsDto(sharedInbox: "\(baseAddress)/shared/inbox"),
attachment: attachments.map({ PersonAttachmentDto(name: $0.key ?? "",
value: $0.htmlValue(baseAddress: baseAddress)) }),
tag: hashtags.map({ PersonHashtagDto(type: .hashtag, name: $0.hashtag, href: "\(baseAddress)/hashtag/\($0.hashtag)") })
tag: hashtags.map({ PersonHashtagDto(type: .hashtag, name: $0.hashtag, href: "\(baseAddress)/tags/\($0.hashtag)") })
)

return try await personDto.encodeActivityResponse(for: request)
Expand Down Expand Up @@ -580,12 +580,12 @@ struct ActivityPubActorsController {
/// "sensitive": false,
/// "tag": [
/// {
/// "href": "https://vernissage.photos/hashtag/blackandwhite",
/// "href": "https://vernissage.photos/tags/blackandwhite",
/// "name": "#blackandwhite",
/// "type": "Hashtag"
/// },
/// {
/// "href": "https://vernissage.photos/hashtag/streetphotography",
/// "href": "https://vernissage.photos/tags/streetphotography",
/// "name": "#streetphotography",
/// "type": "Hashtag"
/// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ struct TimelinesController {
/// "tags": [
/// {
/// "name": "street",
/// "url": "https://vernissage.photos/hashtag/street"
/// "url": "https://vernissage.photos/tags/street"
/// }
/// ],
/// "updatedAt": "2024-02-10T06:16:39.852Z",
Expand Down
16 changes: 8 additions & 8 deletions Sources/VernissageServer/Controllers/TrendingController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,31 +302,31 @@ struct TrendingController {
/// "data": [
/// {
/// "name": "analogvibes",
/// "url": "https://vernissage.photos/hashtag/analogvibes"
/// "url": "https://vernissage.photos/tags/analogvibes"
/// },
/// {
/// "name": "experimentalfilm",
/// "url": "https://vernissage.photos/hashtag/experimentalfilm"
/// "url": "https://vernissage.photos/tags/experimentalfilm"
/// },
/// {
/// "name": "fomapan100",
/// "url": "https://vernissage.photos/hashtag/fomapan100"
/// "url": "https://vernissage.photos/tags/fomapan100"
/// },
/// {
/// "name": "fotoperiodismo",
/// "url": "https://vernissage.photos/hashtag/fotoperiodismo"
/// "url": "https://vernissage.photos/tags/fotoperiodismo"
/// },
/// {
/// "name": "mediumformatfilm",
/// "url": "https://vernissage.photos/hashtag/mediumformatfilm"
/// "url": "https://vernissage.photos/tags/mediumformatfilm"
/// },
/// {
/// "name": "photography",
/// "url": "https://vernissage.photos/hashtag/photography"
/// "url": "https://vernissage.photos/tags/photography"
/// },
/// {
/// "name": "portrait",
/// "url": "https://vernissage.photos/hashtag/portrait"
/// "url": "https://vernissage.photos/tags/portrait"
/// }
/// ],
/// "maxId": "7333887748636758017",
Expand All @@ -353,7 +353,7 @@ struct TrendingController {

let trending = try await trendingService.hashtags(on: request.db, linkableParams: linkableParams, period: period.translate())
let hashtagDtos = await trending.data.asyncMap({
HashtagDto(url: "\(baseAddress)/hashtag/\($0.hashtag)", name: $0.hashtag)
HashtagDto(url: "\(baseAddress)/tags/\($0.hashtag)", name: $0.hashtag)
})

return LinkableResultDto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ extension StatusDto {
activityPubId: status.activityPubId,
activityPubUrl: status.activityPubUrl,
attachments: attachments,
tags: status.hashtags.map({ HashtagDto(url: "\(baseAddress)/hashtag/\($0.hashtag)", name: $0.hashtag) }),
tags: status.hashtags.map({ HashtagDto(url: "\(baseAddress)/tags/\($0.hashtag)", name: $0.hashtag) }),
reblog: reblog,
category: CategoryDto(from: status.category),
application: status.application,
Expand Down
2 changes: 1 addition & 1 deletion Tests/ActivityPubKitTests/ActivityDtoDeserialization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ struct ActivityDtoDeserialization {
"summary": "Test summary",
"tag": [
{
"href": "https://example.com/hashtag/Apple",
"href": "https://example.com/tags/Apple",
"name": "Apple",
"type": "Emoji"
}
Expand Down

0 comments on commit cf163e6

Please sign in to comment.