Repository: saleor/saleor

Issue:
PluginUpdate mutation return empty name and description
### What I'm trying to achieve
using pluginUpdate mutation, on the latest version (master), i think this happened after a recent change that fixed the mutation returning null configurations

### Steps to reproduce the problem
1. use pluginUpdate to update any plugin
2. the plugin return empty string name and description

plugin:
active: true
configuration: (8) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
description: ""
id: "mirumee.payments.braintree"
name: ""
__typename: "Plugin"

### What I expected to happen
return plugin name and description

### Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->

**System information**
Operating system:



Discussion:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.


Resolving patch:
diff --git a/saleor/plugins/manager.py b/saleor/plugins/manager.py
--- a/saleor/plugins/manager.py
+++ b/saleor/plugins/manager.py
@@ -485,9 +485,12 @@ def save_plugin_configuration(self, plugin_id, cleaned_data: dict):
                     identifier=plugin_id,
                     defaults={"configuration": plugin.configuration},
                 )
-                return plugin.save_plugin_configuration(
+                configuration = plugin.save_plugin_configuration(
                     plugin_configuration, cleaned_data
                 )
+                configuration.name = plugin.PLUGIN_NAME
+                configuration.description = plugin.PLUGIN_DESCRIPTION
+                return configuration
 
     def get_plugin(self, plugin_id: str) -> Optional["BasePlugin"]:
         for plugin in self.plugins:


Test patch:
diff --git a/saleor/graphql/plugins/tests/test_plugins.py b/saleor/graphql/plugins/tests/test_plugins.py
--- a/saleor/graphql/plugins/tests/test_plugins.py
+++ b/saleor/graphql/plugins/tests/test_plugins.py
@@ -252,36 +252,38 @@ def test_query_plugin_configuration_as_customer_user(user_api_client, settings):
 
 
 PLUGIN_UPDATE_MUTATION = """
-        mutation pluginUpdate(
-            $id: ID!,
-            $active: Boolean,
-            $configuration: [ConfigurationItemInput]
-        ){pluginUpdate(
-            id:$id,
-            input:{active: $active, configuration: $configuration}
-        ){
-            plugin{
-              name
-              active
-              configuration{
+    mutation pluginUpdate(
+        $id: ID!
+        $active: Boolean
+        $configuration: [ConfigurationItemInput]
+    ) {
+        pluginUpdate(
+            id: $id
+            input: { active: $active, configuration: $configuration }
+        ) {
+            plugin {
                 name
-                value
-                type
-                helpText
-                label
-              }
+                description
+                active
+                configuration {
+                    name
+                    value
+                    type
+                    helpText
+                    label
+                }
             }
-            errors{
-              field
-              message
+            errors {
+                field
+                message
             }
             pluginsErrors {
-              field
-              code
+                field
+                code
             }
-          }
         }
-    """
+    }
+"""
 
 
 @pytest.mark.parametrize(
@@ -310,6 +312,11 @@ def test_plugin_configuration_update(
     )
     content = get_graphql_content(response)
 
+    plugin_data = content["data"]["pluginUpdate"]["plugin"]
+
+    assert plugin_data["name"] == plugin.PLUGIN_NAME
+    assert plugin_data["description"] == plugin.PLUGIN_DESCRIPTION
+
     plugin = PluginConfiguration.objects.get(identifier=PluginSample.PLUGIN_ID)
     assert plugin.active == active
 
@@ -321,7 +328,7 @@ def test_plugin_configuration_update(
     assert second_configuration_item["name"] == old_configuration[1]["name"]
     assert second_configuration_item["value"] == old_configuration[1]["value"]
 
-    configuration = content["data"]["pluginUpdate"]["plugin"]["configuration"]
+    configuration = plugin_data["configuration"]
     assert configuration is not None
     assert configuration[0]["name"] == updated_configuration_item["name"]
     assert configuration[0]["value"] == updated_configuration_item["value"]