Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def from_component(cls, library_key, component, associated_collections=None):
modified=draft.created,
draft_version_num=draft.version_num,
published_version_num=published.version_num if published else None,
published_display_name=published.title if published else None,
last_published=None if last_publish_log is None else last_publish_log.published_at,
published_by=published_by,
last_draft_created=last_draft_created,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ class ContainerMetadata(PublishableItem):
container_key: LibraryContainerLocator
container_type: ContainerType
container_pk: int
published_display_name: str | None

@classmethod
def from_container(cls, library_key, container: Container, associated_collections=None):
Expand Down
1 change: 1 addition & 0 deletions openedx/core/djangoapps/content_libraries/api/libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class PublishableItem(LibraryItem):
"""
draft_version_num: int
published_version_num: int | None = None
published_display_name: str | None
last_published: datetime | None = None
# The username of the user who last published this.
published_by: str = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def get(self, request, container_key: LibraryContainerLocator):
}
]
"""
published = request.GET.get('published', False)
published = request.GET.get('published', 'false').lower() == 'true'
api.require_permission_for_library_key(
container_key.lib_key,
request.user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class PublishableItemSerializer(serializers.Serializer):
"""
id = serializers.SerializerMethodField()
display_name = serializers.CharField()
published_display_name = serializers.CharField(required=False)
tags_count = serializers.IntegerField(read_only=True)
last_published = serializers.DateTimeField(format=DATETIME_FORMAT, read_only=True)
published_by = serializers.CharField(read_only=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ def test_library_blocks(self): # pylint: disable=too-many-statements
block_data["has_unpublished_changes"] = False
block_data["last_published"] = publish_date.isoformat().replace('+00:00', 'Z')
block_data["published_by"] = "Bob"
block_data["published_display_name"] = "Blank Problem"
self.assertDictContainsEntries(self._get_library_block(block_id), block_data)
assert self._get_library_blocks(lib_id)['results'] == [block_data]

Expand Down Expand Up @@ -440,6 +441,7 @@ def test_library_blocks_studio_view(self):
block_data["has_unpublished_changes"] = False
block_data["last_published"] = publish_date.isoformat().replace('+00:00', 'Z')
block_data["published_by"] = "Bob"
block_data["published_display_name"] = "Text"
self.assertDictContainsEntries(self._get_library_block(block_id), block_data)
assert self._get_library_blocks(lib_id)['results'] == [block_data]

Expand Down