From 736ec2d7f59f219a9411d1b939ed82583fe0d586 Mon Sep 17 00:00:00 2001
From: Angelina Filippova <linakirsanova@gmail.com>
Date: Sun, 20 Oct 2019 16:38:43 +0000
Subject: [PATCH] Remove fetching initial data for config

---
 CHANGELOG.md                    |   1 +
 src/api/initialDataForConfig.js | 117 --------------------------------
 src/store/modules/settings.js   |   7 +-
 3 files changed, 2 insertions(+), 123 deletions(-)
 delete mode 100644 src/api/initialDataForConfig.js

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8efd8c5c..cf9cc2a7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 ### Changed
 
 - `mailerEnabled` must be set to `true` in order to require password reset (password reset currently only works via email)
+- remove fetching initial data for configuring server settings
 - Actions in users module (ActivateUsers, AddRight, DeactivateUsers, DeleteRight, DeleteUsers) now accept an array of users instead of one user
 
 ### Added
diff --git a/src/api/initialDataForConfig.js b/src/api/initialDataForConfig.js
deleted file mode 100644
index f24ffb9a..00000000
--- a/src/api/initialDataForConfig.js
+++ /dev/null
@@ -1,117 +0,0 @@
-export const initialSettings = [
-  {
-    group: 'pleroma',
-    key: ':instance',
-    value: [
-      { 'tuple': [':name', 'Pleroma'] },
-      { 'tuple': [':email', 'example@example.com'] },
-      { 'tuple': [':notify_email', 'noreply@example.com'] },
-      { 'tuple': [':description', 'A Pleroma instance, an alternative fediverse server'] },
-      { 'tuple': [':limit', 5000] },
-      { 'tuple': [':remote_limit', 100000] },
-      { 'tuple': [':upload_limit', 16 * 1048576] },
-      { 'tuple': [':avatar_upload_limit', 2 * 1048576] },
-      { 'tuple': [':background_upload_limit', 4 * 1048576] },
-      { 'tuple': [':banner_upload_limit', 4 * 1048576] },
-      { 'tuple': [':poll_limits', [
-        { 'tuple': [':max_options', 20] },
-        { 'tuple': [':max_option_chars', 200] },
-        { 'tuple': [':min_expiration', 0] },
-        { 'tuple': [':max_expiration', 365 * 86400] }
-      ]] },
-      { 'tuple': [':registrations_open', true] },
-      { 'tuple': [':invites_enabled', false] },
-      { 'tuple': [':account_activation_required', false] },
-      { 'tuple': [':federating', true] },
-      { 'tuple': [':federation_reachability_timeout_days', 7] },
-      { 'tuple':
-        [':federation_publisher_modules', ['Pleroma.Web.ActivityPub.Publisher', 'Pleroma.Web.Websub', 'Pleroma.Web.Salmon']] },
-      { 'tuple': [':allow_relay', true] },
-      { 'tuple': [':rewrite_policy', 'Pleroma.Web.ActivityPub.MRF.NoOpPolicy'] },
-      { 'tuple': [':public', true] },
-      { 'tuple': [':managed_config', true] },
-      { 'tuple': [':static_dir', 'instance/static/'] },
-      { 'tuple': [':allowed_post_formats', ['text/plain', 'text/html', 'text/markdown', 'text/bbcode']] },
-      { 'tuple': [':mrf_transparency', true] },
-      { 'tuple': [':extended_nickname_format', false] },
-      { 'tuple': [':max_pinned_statuses', 1] },
-      { 'tuple': [':no_attachment_links', false] },
-      { 'tuple': [':max_report_comment_size', 1000] },
-      { 'tuple': [':safe_dm_mentions', false] },
-      { 'tuple': [':healthcheck', false] },
-      { 'tuple': [':remote_post_retention_days', 90] },
-      { 'tuple': [':skip_thread_containment', true] },
-      { 'tuple': [':limit_to_local_content', ':unauthenticated'] },
-      { 'tuple': [':dynamic_configuration', true] },
-      { 'tuple': [':max_account_fields', 10] },
-      { 'tuple': [':max_remote_account_fields', 20] },
-      { 'tuple': [':account_field_name_length', 255] },
-      { 'tuple': [':account_field_value_length', 255] },
-      { 'tuple': [':external_user_synchronization', true] },
-      { 'tuple': [':user_bio_length', 5000] },
-      { 'tuple': [':user_name_length', 100] }
-    ]
-  },
-  {
-    group: 'mime',
-    key: ':types',
-    value: {
-      'application/activity+json': ['activity+json'],
-      'application/jrd+json': ['jrd+json'],
-      'application/ld+json': ['activity+json'],
-      'application/xml': ['xml'],
-      'application/xrd+xml': ['xrd+xml']
-    }
-  },
-  {
-    group: 'cors_plug',
-    key: ':max_age',
-    value: 86400
-  },
-  {
-    group: 'cors_plug',
-    key: ':methods',
-    value: ['POST', 'PUT', 'DELETE', 'GET', 'PATCH', 'OPTIONS']
-  },
-  {
-    group: 'cors_plug',
-    key: ':expose',
-    value: [
-      'Link',
-      'X-RateLimit-Reset',
-      'X-RateLimit-Limit',
-      'X-RateLimit-Remaining',
-      'X-Request-Id',
-      'Idempotency-Key'
-    ]
-  },
-  {
-    group: 'cors_plug',
-    key: ':credentials',
-    value: true
-  },
-  {
-    group: 'cors_plug',
-    key: ':headers',
-    value: ['Authorization', 'Content-Type', 'Idempotency-Key']
-  },
-  {
-    group: 'tesla',
-    key: ':adapter',
-    value: 'Tesla.Adapter.Hackney'
-  },
-  {
-    group: 'pleroma',
-    key: ':markup',
-    value: [
-      { 'tuple': [':allow_inline_images', true] },
-      { 'tuple': [':allow_headings', false] },
-      { 'tuple': [':allow_tables', false] },
-      { 'tuple': [':allow_fonts', false] },
-      { 'tuple': [':scrub_policy', [
-        'Pleroma.HTML.Transform.MediaProxy',
-        'Pleroma.HTML.Scrubber.Default'
-      ]] }
-    ]
-  }
-]
diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js
index 3ee58c4e..bb6bd8c1 100644
--- a/src/store/modules/settings.js
+++ b/src/store/modules/settings.js
@@ -1,5 +1,4 @@
 import { fetchSettings, updateSettings, uploadMedia } from '@/api/settings'
-import { initialSettings } from '@/api/initialDataForConfig'
 import { filterIgnored, parseTuples, valueHasTuples, wrapConfig } from './normalizers'
 
 const settings = {
@@ -116,11 +115,7 @@ const settings = {
     async FetchSettings({ commit, dispatch, getters }) {
       commit('SET_LOADING', true)
       const response = await fetchSettings(getters.authHost, getters.token)
-      if (response.data.configs.length === 0) {
-        dispatch('SubmitChanges', initialSettings)
-      } else {
-        commit('SET_SETTINGS', response.data.configs)
-      }
+      commit('SET_SETTINGS', response.data.configs)
       commit('SET_LOADING', false)
     },
     RewriteConfig({ commit }, { tab, data }) {
-- 
GitLab