diff --git a/cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py b/cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py index a976b4954fac..ab01a4104d05 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py +++ b/cms/djangoapps/contentstore/rest_api/v1/serializers/vertical_block.py @@ -5,6 +5,7 @@ from django.urls import reverse from rest_framework import serializers +from cms.djangoapps.contentstore.toggles import use_tagging_taxonomy_list_page from cms.djangoapps.contentstore.helpers import ( xblock_studio_url, xblock_type_display_name, @@ -110,6 +111,7 @@ def get_actions(self, obj): # pylint: disable=unused-argument Method to get actions for each child xlock of the unit. """ + can_manage_tags = use_tagging_taxonomy_list_page() # temporary decision defining the default value 'True' for each xblock. actions = { "can_copy": True, @@ -117,6 +119,7 @@ def get_actions(self, obj): # pylint: disable=unused-argument "can_move": True, "can_manage_access": True, "can_delete": True, + "can_manage_tags": can_manage_tags, } return actions @@ -129,3 +132,4 @@ class VerticalContainerSerializer(serializers.Serializer): children = ChildVerticalContainerSerializer(many=True) is_published = serializers.BooleanField() + can_paste_component = serializers.BooleanField() diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_vertical_block.py b/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_vertical_block.py index 063ba9ed5420..cd71063ab88a 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_vertical_block.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_vertical_block.py @@ -3,8 +3,10 @@ """ from django.urls import reverse from rest_framework import status +from edx_toggles.toggles.testutils import override_waffle_flag from cms.djangoapps.contentstore.tests.utils import CourseTestCase +from cms.djangoapps.contentstore.toggles import ENABLE_TAGGING_TAXONOMY_LIST_PAGE from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID from xmodule.modulestore.django import ( modulestore, @@ -148,6 +150,7 @@ def test_xblock_is_published(self): response = self.client.get(url) self.assertTrue(response.data["is_published"]) + @override_waffle_flag(ENABLE_TAGGING_TAXONOMY_LIST_PAGE, True) def test_children_content(self): """ Check that returns valid response with children of vertical container. @@ -187,7 +190,8 @@ def test_children_content(self): "can_duplicate": True, "can_move": True, "can_manage_access": True, - "can_delete": True + "can_delete": True, + "can_manage_tags": True, }, "user_partition_info": expected_user_partition_info, "user_partitions": expected_user_partitions @@ -201,7 +205,8 @@ def test_children_content(self): "can_duplicate": True, "can_move": True, "can_manage_access": True, - "can_delete": True + "can_delete": True, + "can_manage_tags": True, }, "user_partition_info": expected_user_partition_info, "user_partitions": expected_user_partitions, @@ -219,3 +224,13 @@ def test_not_valid_usage_key_string(self): url = self.get_reverse_url(usage_key_string) response = self.client.get(url) self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) + + @override_waffle_flag(ENABLE_TAGGING_TAXONOMY_LIST_PAGE, False) + def test_actions_with_turned_off_taxonomy_flag(self): + """ + Check that action manage_tags for each child item has the same value as taxonomy flag. + """ + url = self.get_reverse_url(self.vertical.location) + response = self.client.get(url) + for children in response.data["children"]: + self.assertFalse(children["actions"]["can_manage_tags"]) diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/vertical_block.py b/cms/djangoapps/contentstore/rest_api/v1/views/vertical_block.py index a1e87e780bf3..eb042a481fd4 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/vertical_block.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/vertical_block.py @@ -195,7 +195,8 @@ def get(self, request: Request, usage_key_string: str): "can_duplicate": true, "can_move": true, "can_manage_access": true, - "can_delete": true + "can_delete": true, + "can_manage_tags": true, } }, { @@ -207,7 +208,8 @@ def get(self, request: Request, usage_key_string: str): "can_duplicate": true, "can_move": true, "can_manage_access": true, - "can_delete": true + "can_delete": true, + "can_manage_tags": true, } }, { @@ -219,11 +221,13 @@ def get(self, request: Request, usage_key_string: str): "can_duplicate": true, "can_move": true, "can_manage_access": true, - "can_delete": true + "can_delete": true, + "can_manage_tags": true, } }, ], - "is_published": false + "is_published": false, + "can_paste_component": true, } ``` """ @@ -247,6 +251,10 @@ def get(self, request: Request, usage_key_string: str): }) is_published = not modulestore().has_changes(current_xblock) - container_data = {"children": children, "is_published": is_published} + container_data = { + "children": children, + "is_published": is_published, + "can_paste_component": True, + } serializer = VerticalContainerSerializer(container_data) return Response(serializer.data)