From ddc7d16a7df689771c7df0e1acd5e364c7c267a4 Mon Sep 17 00:00:00 2001
From: Angelina Filippova <linakirsanova@gmail.com>
Date: Wed, 11 Mar 2020 18:48:55 +0300
Subject: [PATCH] Fix parsing tuples in Pleroma.Upload.Filter.Mogrify and
 Pleroma.Emails.Mailer settings

---
 CHANGELOG.md                     | 4 ++++
 src/store/modules/normalizers.js | 7 +++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 07947ea5..ac4e0a92 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Ability to see local statuses in Statuses by instance section
 - Ability to configure Oban.Cron settings and settings for notifications streamer
 
+### Fixed
+
+- Fix parsing tuples in Pleroma.Upload.Filter.Mogrify and Pleroma.Emails.Mailer settings
+
 ## [2.0] - 2020-02-27
 
 ### Added
diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js
index ba4bea81..4d23c957 100644
--- a/src/store/modules/normalizers.js
+++ b/src/store/modules/normalizers.js
@@ -63,6 +63,9 @@ export const parseNonTuples = (key, value) => {
     return updated
   }
   if (key === ':args') {
+    if (typeof value === 'string') {
+      return [value]
+    }
     const index = value.findIndex(el => typeof el === 'object' && el.tuple.includes('implode'))
     const updated = value.map((el, i) => i === index ? 'implode' : el)
     return updated
@@ -80,8 +83,8 @@ export const parseTuples = (tuples, key) => {
       accum[item.tuple[0]] = item.tuple[1].reduce((acc, mascot) => {
         return [...acc, { [mascot.tuple[0]]: { ...mascot.tuple[1], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}]
       }, [])
-    } else if (
-      item.tuple[0] === ':groups' || item.tuple[0] === ':replace' || item.tuple[0] === ':retries') {
+    } else if (Array.isArray(item.tuple[1]) &&
+      (item.tuple[0] === ':groups' || item.tuple[0] === ':replace' || item.tuple[0] === ':retries')) {
       accum[item.tuple[0]] = item.tuple[1].reduce((acc, group) => {
         return [...acc, { [group.tuple[0]]: { value: group.tuple[1], id: `f${(~~(Math.random() * 1e8)).toString(16)}` }}]
       }, [])
-- 
GitLab