about summary refs log tree commit diff
path: root/app/javascript/mastodon/reducers/list_editor.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-02-13 18:52:02 +0100
committerEugen Rochko <eugen@zeonfederated.com>2019-02-13 18:52:02 +0100
commit188f1c7c89d6fc7349302a9680bac9a82515cb90 (patch)
tree28031bac4e0a92bbe263e8ff88c8c66a2ba5c9f1 /app/javascript/mastodon/reducers/list_editor.js
parentdad339da6d19679f0361bfd49d9bcf3a3517af0c (diff)
Add list title editing (#9748)
* Add list title editing

Port changes made by ash for glitch-soc

* Code style fixes
Diffstat (limited to 'app/javascript/mastodon/reducers/list_editor.js')
-rw-r--r--app/javascript/mastodon/reducers/list_editor.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/javascript/mastodon/reducers/list_editor.js b/app/javascript/mastodon/reducers/list_editor.js
index 02a0dabb1..91e524dd5 100644
--- a/app/javascript/mastodon/reducers/list_editor.js
+++ b/app/javascript/mastodon/reducers/list_editor.js
@@ -22,6 +22,7 @@ import {
 const initialState = ImmutableMap({
   listId: null,
   isSubmitting: false,
+  isChanged: false,
   title: '',
 
   accounts: ImmutableMap({
@@ -47,10 +48,16 @@ export default function listEditorReducer(state = initialState, action) {
       map.set('isSubmitting', false);
     });
   case LIST_EDITOR_TITLE_CHANGE:
-    return state.set('title', action.value);
+    return state.withMutations(map => {
+      map.set('title', action.value);
+      map.set('isChanged', true);
+    });
   case LIST_CREATE_REQUEST:
   case LIST_UPDATE_REQUEST:
-    return state.set('isSubmitting', true);
+    return state.withMutations(map => {
+      map.set('isSubmitting', true);
+      map.set('isChanged', false);
+    });
   case LIST_CREATE_FAIL:
   case LIST_UPDATE_FAIL:
     return state.set('isSubmitting', false);