hometown-fork / hometown

A supported fork of Mastodon that provides local posting and a wider range of content types.
GNU Affero General Public License v3.0
743 stars 55 forks source link

Add option to force all accounts to be local by default #1189

Open mandrachek opened 1 year ago

mandrachek commented 1 year ago

Pitch

In addition a server setting to set new accounts to local by default (#704), I'd like to see

Motivation

A server with such a configuration would have its toots be unfederated by default, and users would have to take action to make a post federated. This would make it easier for communities needing a private space to still be part of the fediverse, with it being more difficult for users to accidentally federate content unintentionally.

dariusk commented 1 year ago

This is a good idea. I can't promise I will implement it any time soon but I would be open to pull requests (although frankly I am dreading the 4.0 Mastodon release and probably any PRs before that happens will be functionally useless to this project).

tillkruss commented 1 year ago

I'd love to see this as well. Our hometown user-base it not technical enough to change this setting without confusion.

I guess I need to run a cronjob that will update the setting for all new users upon registration.

owil commented 1 year ago

The federated emoji is really helpful for people who have set posts to local only by default and use a mobile application.

Here's a copy-paste of some changes I'd used in the past, placed in _/app/services/post_statusservice.rb

My changes add a federated_post emoji for people whose federation settings default to local only.

  def local_only_option(local_only, in_reply_to, federation_setting, text, spoiler_text)
    # This is intended for third party clients. The admin can set a custom
    # :local_only:
    # emoji that users can append to force a post to be local only.
    # :federated_post:
    # emoji that users can append to force a post to be federated.
    # If both emojis are present, the :local_only: emoji takes precedence.
    if text.include?(':local_only:') ||
       spoiler_text&.include?(':local_only')
      return true
    end
    if text.include?(':federated_post:') ||
       spoiler_text&.include?(':federated_post:')
      return false
    end
    if local_only.nil?
      if in_reply_to && in_reply_to.local_only
        return true
      end
      if in_reply_to && !in_reply_to.local_only
        return false
      end
      return !federation_setting
    end
    local_only
  end

It's an easy file change to make, but every time I update Hometown I have to redo these changes, so I haven't used this lately.

I hope the federated emoji feature could be added to Hometown even if there isn't a way to default all posts to local.

dariusk commented 1 year ago

I won't be able to do this for v1.1.0, but I have tagged it for the next release.