bluesky-social / indigo

Go source code for Bluesky's atproto services.
https://atproto.com
Apache License 2.0
650 stars 98 forks source link

ModerationQueryStatuses always return nil and missing onlyMuted param #699

Open xtianpu opened 2 months ago

xtianpu commented 2 months ago

ModerationQueryStatuses always return nil for all reviewState and missing onlyMuted param (here)

I have tested by manual call to https://agaric.us-west.host.bsky.network/xrpc/tools.ozone.moderation.queryStatuses?limit=50&includeMuted=true&sortField=lastReportedAt&sortDirection=desc and responded as expected.

xtianpu commented 2 months ago

Hi @bnewbold, thank you for adding onlyMuted param.

Anyway, I have found why ModerationQueryStatuses always return nil, looks like because Appealed type is bool and forced me to use true and false value only which resulting the PDS always returning nil since there is no True or False Appealed records but nil.

I have tested using this params, and it worked as expected by providing empty string to "appealed" map key as below:

params := map[string]interface{}{
        "appealed":       "",
        "comment":        "",
        "cursor":         "",
        "includeMuted":   true,
        "lastReviewedBy": "",
        "limit":          50,
        "onlyMuted":      false,
        "reportedAfter":  "",
        "reportedBefore": "",
        "reviewState":    "tools.ozone.moderation.defs#reviewOpen",
        "reviewedAfter":  "",
        "reviewedBefore": "",
        "sortDirection":  "desc",
        "sortField":      "lastReportedAt",
        "subject":        "",
        "takendown":      false,
}

Response of request by using above params as below:

&ozone.ModerationDefs_SubjectStatusView{
            Appealed:           (*bool)(nil),
            Comment:            (*string)(nil),
            CreatedAt:          "2024-07-13T17:08:18.950Z",
            Id:                 16623,
            LastAppealedAt:     (*string)(nil),
            LastReportedAt:     &"2024-07-13T17:08:18.945Z",
            LastReviewedAt:     (*string)(nil),
            LastReviewedBy:     (*string)(nil),
            MuteReportingUntil: (*string)(nil),
            MuteUntil:          (*string)(nil),
            ReviewState:        &"tools.ozone.moderation.defs#reviewOpen",
            Subject:            &ozone.ModerationDefs_SubjectStatusView_Subject{
                AdminDefs_RepoRef: &atproto.AdminDefs_RepoRef{LexiconTypeID:"com.atproto.admin.defs#repoRef", Did:"did:plc:xxxxxxxxxxxxxxxxxxx"},
                RepoStrongRef:     (*atproto.RepoStrongRef)(nil),
            },
            SubjectBlobCids:   {},
            SubjectRepoHandle: &"zxzxzx.bsky.social",
            SuspendUntil:      (*string)(nil),
            Tags:              {"lang:in"},
            Takendown:         &bool(false),
            UpdatedAt:         "2024-07-13T17:08:19.531Z",
        },