Fix issue with visible other media in carousel.

This commit is contained in:
Marcin Czachursk 2023-02-21 10:55:17 +01:00
parent 6d7934c35a
commit 7811ff3bd5
3 changed files with 13 additions and 3 deletions

View File

@ -22,7 +22,17 @@ are attachments of another user in the response).
Github issue: [https://github.com/pixelfed/pixelfed/issues/4196](https://github.com/pixelfed/pixelfed/issues/4196)
### **Comments are not visible**
API is not returning comments added directly to the status (account `amiko`)?
`[GET] https://pxlmo.com/api/v1/statuses/533554842410484883/context`
Web app is using endpoint: `https://pxlmo.com/api/v2/statuses/533554842410484883/replies?limit=3` for downloading statuses.
Comments are visible when we open status from another server (e.g. from https://pixelfed.social), because they are transfered
with the status via ActivityPub.
### **Follow/unfollow hashtags is not available through the API**
Pixelfed uses endpoint (POST): https://pixelfed.social/api/local/discover/tag/subscribe, with body:

View File

@ -74,7 +74,7 @@ extension Client {
private func getCommentDescendants(to statusId: String, showDivider: Bool, to commentViewModels: inout [CommentModel]) async throws {
let context = try await pixelfedClient.getContext(for: statusId)
let descendants = context.descendants.toStatusViewModel()
let descendants = context.descendants.toStatusModels()
for status in descendants {
commentViewModels.append(CommentModel(status: status, showDivider: showDivider))

View File

@ -73,7 +73,7 @@ public class StatusModel: ObservableObject {
self.commentsDisabled = orginalStatus.commentsDisabled
var mediaAttachments: [AttachmentModel] = []
for item in orginalStatus.mediaAttachments {
for item in orginalStatus.getAllImageMediaAttachments() {
mediaAttachments.append(AttachmentModel(attachment: item))
}
@ -108,7 +108,7 @@ public extension StatusModel {
}
public extension [Status] {
func toStatusViewModel() -> [StatusModel] {
func toStatusModels() -> [StatusModel] {
self
.sorted(by: { lhs, rhs in
lhs.id < rhs.id