Commit 5f0e237a by Calen Pennington

Store the id of the publishing user on publish

parent 208857ed
...@@ -527,7 +527,7 @@ def publish_draft(request): ...@@ -527,7 +527,7 @@ def publish_draft(request):
raise PermissionDenied() raise PermissionDenied()
item = modulestore().get_item(location) item = modulestore().get_item(location)
_xmodule_recurse(item, lambda i: modulestore().publish(i.location)) _xmodule_recurse(item, lambda i: modulestore().publish(i.location, request.user.id))
return HttpResponse() return HttpResponse()
......
...@@ -159,7 +159,7 @@ class DraftModuleStore(ModuleStoreBase): ...@@ -159,7 +159,7 @@ class DraftModuleStore(ModuleStoreBase):
""" """
return super(DraftModuleStore, self).delete_item(as_draft(location)) return super(DraftModuleStore, self).delete_item(as_draft(location))
def publish(self, location): def publish(self, location, published_by_id):
""" """
Save a current draft to the underlying modulestore Save a current draft to the underlying modulestore
""" """
...@@ -167,6 +167,7 @@ class DraftModuleStore(ModuleStoreBase): ...@@ -167,6 +167,7 @@ class DraftModuleStore(ModuleStoreBase):
metadata = {} metadata = {}
metadata.update(draft.metadata) metadata.update(draft.metadata)
metadata['published_date'] = tuple(datetime.utcnow().timetuple()) metadata['published_date'] = tuple(datetime.utcnow().timetuple())
metadata['published_by'] = published_by_id
super(DraftModuleStore, self).update_item(location, draft.definition.get('data', {})) super(DraftModuleStore, self).update_item(location, draft.definition.get('data', {}))
super(DraftModuleStore, self).update_children(location, draft.definition.get('children', [])) super(DraftModuleStore, self).update_children(location, draft.definition.get('children', []))
super(DraftModuleStore, self).update_metadata(location, metadata) super(DraftModuleStore, self).update_metadata(location, metadata)
......
...@@ -409,7 +409,7 @@ class XModuleDescriptor(Plugin, HTMLSnippet, ResourceTemplates): ...@@ -409,7 +409,7 @@ class XModuleDescriptor(Plugin, HTMLSnippet, ResourceTemplates):
# cdodge: this is a list of metadata names which are 'system' metadata # cdodge: this is a list of metadata names which are 'system' metadata
# and should not be edited by an end-user # and should not be edited by an end-user
system_metadata_fields = ['data_dir', 'published_date'] system_metadata_fields = ['data_dir', 'published_date', 'published_by']
# A list of descriptor attributes that must be equal for the descriptors to # A list of descriptor attributes that must be equal for the descriptors to
# be equal # be equal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment