fiatjaf / relay29

NIP-29 relay
MIT License
13 stars 4 forks source link

Edits in event_policy.go for moderation range and "h" tag #2

Closed cryptographichistory closed 8 months ago

cryptographichistory commented 8 months ago

In event_policy.go, it seems like there are two places that required edits to add users etc:

1) restrictInvalidModerationActions() is being tested for all events? I may be misinterpreting, but this seems to work better bypassing the tests for non-moderation actions like this:

func restrictInvalidModerationActions(ctx context.Context, event *nostr.Event) (reject bool, msg string) {
    if !(event.Kind >= 9000 && event.Kind <= 9006) {  // is it a broader range of Kinds to bypass?
        return false, ""             // it's not a moderation action
    }

2) Also, it seems during the flow of a Join request, when the user is being added automatically, relay29 is looking for an "h" tag like in:

reactToJoinRequest(ctx context.Context, event *nostr.Event) {}

Seemed like relay29 was happier after adding in an "h" tag like this:

        Tags: nostr.Tags{
            nostr.Tag{"h", group.ID}, 
            nostr.Tag{"p", event.PubKey},
        },

I'm still working through it, so I may have misinterpreted. But hope this is a step forward? Thanks.

fiatjaf commented 8 months ago

Looks like you are right indeed. I'll check better tomorrow.