hyphacoop / social.distributed.press

A Social Inbox for Decentralized Publishing and ActivityPub.
https://hypha.coop/dripline/announcing-dp-social-inbox/
GNU Affero General Public License v3.0
23 stars 3 forks source link

feat: auto-accept follow requests #18

Closed akhileshthite closed 5 months ago

akhileshthite commented 11 months ago

When I created a new blog on Sutty and had it create a Fediverse account, I noticed that it required an approval for new followers.

Originally posted by @maisutton in https://github.com/hyphacoop/distributed-press-organizing/issues/87#issuecomment-1787765033

akhileshthite commented 11 months ago

When I created a new blog on Sutty and had it create a Fediverse account, I noticed that it required an approval for new followers.

Originally posted by @maisutton in hyphacoop/distributed-press-organizing#87 (comment)

For this change, in the ingestActivity method, we should bypass moderation for Follow type activities and approve them directly, correct? Should I send a PR for this @RangerMauve?

  async ingestActivity (fromActor: string, activity: APActivity): Promise<void> {
    const activityId = activity.id

    // TODO: handle array of string case and nested object
    if (typeof activityId !== 'string') {
      throw new Error('Activities must contain an ID')
    }

    const activityActor = activity.actor

    // TODO: handle array of string case and nested object
    if (typeof activityActor !== 'string') {
      throw new Error('Activities must contain an actor string')
    }

    // Handle Follow activities by automatically approving them
    if (activity.type === 'Follow') {
      // No need for moderation, immediately approve the Follow activity
      await this.approveActivity(fromActor, activityId)
    } else {
      // For all other activities, proceed with moderation
      const mention = await this.actorToMention(activityActor)
      const moderationState = await this.modCheck.check(mention, fromActor)

      // Adding activity to the inbox should happen irrespective of moderation state
      // TODO: trigger hooks
      const actorStore = this.store.forActor(fromActor)
      await actorStore.inbox.add(activity)

      // Handle moderation states for other activities
      if (moderationState === BLOCKED) {
        await this.rejectActivity(fromActor, activityId)
      } else if (moderationState === ALLOWED) {
        await this.approveActivity(fromActor, activityId)
      } else {
        await this.hookSystem.dispatchModerationQueued(fromActor, activity)
      }
    }
  }
fauno commented 11 months ago

IIRC @RangerMauve we talked about allowlisting every follow request (that's isn't superseded by the default blocklist) until we have a moderation queue interface implemented, is that correct?

fauno commented 11 months ago

I mean, we've been using the plugin without having to accept follow requests so far

fauno commented 7 months ago

Related to https://github.com/hyphacoop/distributed-press-organizing/issues/153

RangerMauve commented 5 months ago

Seems to be done?