Skip to content
Snippets Groups Projects

Moving mrf settings from instance to separate mrf group

Merged Alexander Strizhakov requested to merge feature/1631-redesign-mrf-configuration into develop

Merge request reports

Pipeline #27322 passed

Pipeline passed for 9a82de21 on feature/1631-redesign-mrf-configuration

Test coverage 88.50% (0.00%) from 1 job
Approval is optional

Merged by HaelwennHaelwenn 4 years ago (Jun 23, 2020 4:38pm UTC)

Merge details

Pipeline #27586 passed

Pipeline passed for c7d69e92 on develop

Test coverage 88.60% (0.00%) from 1 job

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • I think there should be either:

    • Blocker (similar to when migrations aren't done?) when the old config is used
    • Warning + compatibility for the old config, to deprecate it
    1. There should be a migration for in-db config
    2. as @lanodan said, we should support the old config still. Just do something like that in Pleroma.Config.DeprecationWarnings
    @config_map [{[:instance, :rewrite_policy], [:mrf, :policies]}, {[:instance, :mrf_transparency], [:mrf, :transparency]}, {[:instance, :mrf_transparency_exclusions], [:mrf, :transparency_exclusions]}]
    
    old_namespaces_detected = Enum.reduce(@config_map, [], fn {old, new} = namespace_change, acc ->
      old_config = Pleroma.Config.get(old)
      if old_config do
        Pleroma.Config.put(new, old_config)
        [namespace_change | acc]
      else
        acc
      end
    end)
    
    if old_namespaces_detected != [] do
      # the move points should be generated based on old_namespaces_detected, not implemented because it's hard and this is just an example
      Logger.warn("""
                  Your config is using old namespaces for MRF configuration. They should work for now, but you are advised to change to new namespaces to prevent possible issues later:
                  * `config :pleroma, :instance, rewrite_policy` is now `config :pleroma, :mrf, policies`
                  * `config :pleroma, :instance, mrf_transparency` is now `config :pleroma, :mrf, transparency`
                  * `config :pleroma, :instance, mrf_transparency_exclusions` is now `config :pleroma, :mrf, transparency_exclusions`
                  """)
    end
  • added 1 commit

    • 31ebdf92 - moving mrf settings from instance to separate group

    Compare with previous version

  • added 1 commit

    • 4a711d12 - moving mrf settings from instance to separate group

    Compare with previous version

  • LGTM. :thumbsup:

  • rinpatch
    rinpatch @rinpatch started a thread on the diff
48 Enum.reduce(old_namespaces_detected, err_msg, fn
49 :rewrite_policy, acc ->
50 acc <>
51 "\n* `config :pleroma, :instance, rewrite_policy` is now `config :pleroma, :mrf, policies`\n"
52
53 :mrf_transparency, acc ->
54 acc <>
55 "\n* `config :pleroma, :instance, mrf_transparency` is now `config :pleroma, :mrf, transparency`"
56
57 :mrf_transparency_exclusions, acc ->
58 acc <>
59 "\n* `config :pleroma, :instance, mrf_transparency_exclusions` is now `config :pleroma, :mrf, transparency_exclusions`"
60 end)
61
62 Logger.warn(err_msg)
63 end
  • Please make this a reusable function we can use for later namespace moves:

    def move_namespace_and_warn(namespace_map, warning_preface)

    that can be later called like this:

      def check_old_mrf_config do
        move_namespace_and_warn([
            {[:instance, :rewrite_policy], [:mrf, :policies]},
            {[:instance, :mrf_transparency], [:mrf, :transparency]},
            {[:instance, :mrf_transparency_exclusions], [:mrf, :transparency_exclusions]}
          ], """
             !!!DEPRECATION WARNING!!!
             Your config is using old namespaces for MRF configuration. They should work for now, but you are advised to change to new namespaces to prevent possible issues later:
            """)
      end
    Edited by rinpatch
  • Please register or sign in to reply
  • added 9 commits

    Compare with previous version

  • added 208 commits

    Compare with previous version

  • added 58 commits

    Compare with previous version

  • Alexander Strizhakov changed milestone to %2.1

    changed milestone to %2.1

  • added 269 commits

    Compare with previous version

  • added 45 commits

    Compare with previous version

  • added 61 commits

    Compare with previous version

  • added 147 commits

    Compare with previous version

  • added 74 commits

    Compare with previous version

  • added 567 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Haelwenn
    Haelwenn @lanodan started a thread on the diff
  • 4 4 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
    5 5
    6 6 ## [unreleased]
    7
    8 7 ### Changed
    9 8 - MFR policy to set global expiration for all local Create activities
    10 9 - OGP rich media parser merged with TwitterCard
    10 - Configuration: `rewrite_policy` renamed to `policies` and moved from `instance` to `mrf` group. Old config namespace is deprecated.
    11 - Configuration: `mrf_transparency` renamed to `transparency` and moved from `instance` to `mrf` group. Old config namespace is deprecated.
    12 - Configuration: `mrf_transparency_exclusions` renamed to `transparency_exclusions` and moved from `instance` to `mrf` group. Old config namespace is deprecated.
    13
  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading