Create activity model and add activity creation
This creates the Activity and Genrator models from the Activity Streams spec and. I then created a migration which retro-actively create activities for media uploaded and comments created. Through out the code I've added so automatically activties are created when a user peforms an action (uploading media, commenting, etc.).
This commit is contained in:
@@ -26,6 +26,7 @@ from mediagoblin.tools.response import render_to_response, render_404, \
|
||||
from mediagoblin.tools.text import cleaned_markdown_conversion
|
||||
from mediagoblin.tools.translate import pass_to_ugettext as _
|
||||
from mediagoblin.tools.pagination import Pagination
|
||||
from mediagoblin.tools.federation import create_activity
|
||||
from mediagoblin.user_pages import forms as user_forms
|
||||
from mediagoblin.user_pages.lib import (send_comment_email,
|
||||
add_media_to_collection, build_report_object)
|
||||
@@ -199,7 +200,7 @@ def media_post_comment(request, media):
|
||||
_('Your comment has been posted!'))
|
||||
|
||||
trigger_notification(comment, media, request)
|
||||
|
||||
create_activity("post", comment)
|
||||
add_comment_subscription(request.user, media)
|
||||
|
||||
return redirect_obj(request, media)
|
||||
@@ -261,6 +262,7 @@ def media_collect(request, media):
|
||||
collection.creator = request.user.id
|
||||
collection.generate_slug()
|
||||
collection.save()
|
||||
create_activity("create", collection)
|
||||
|
||||
# Otherwise, use the collection selected from the drop-down
|
||||
else:
|
||||
@@ -287,7 +289,7 @@ def media_collect(request, media):
|
||||
% (media.title, collection.title))
|
||||
else: # Add item to collection
|
||||
add_media_to_collection(collection, media, form.note.data)
|
||||
|
||||
create_activity("add", media)
|
||||
messages.add_message(request, messages.SUCCESS,
|
||||
_('"%s" added to collection "%s"')
|
||||
% (media.title, collection.title))
|
||||
|
||||
Reference in New Issue
Block a user