Skip to content

Commit

Permalink
Preventing dupe favorites from showing up in activities and interacti…
Browse files Browse the repository at this point in the history
…ons.
  • Loading branch information
samuelclay committed Jul 28, 2012
1 parent dffdfa7 commit ff43983
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
38 changes: 18 additions & 20 deletions apps/social/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1967,16 +1967,15 @@ def new_comment_reply(cls, user_id, reply_user_id, reply_content, social_feed_id

@classmethod
def new_comment_like(cls, liking_user_id, comment_user_id, social_feed_id, story_id, story_title, comments):
params = {
'user_id': comment_user_id,
'with_user_id': liking_user_id,
'category': 'comment_like',
'feed_id': social_feed_id,
'content_id': story_id,
'title': story_title,
'content': comments,
}
cls.objects.create(**params)
cls.objects.get_or_create(user_id=comment_user_id,
with_user_id=liking_user_id,
category="comment_like",
feed_id=social_feed_id,
content_id=story_id,
defaults={
"title": story_title,
"content": comments,
})

@classmethod
def new_reply_reply(cls, user_id, reply_user_id, reply_content, social_feed_id, story_id, story_title=None, original_message=None):
Expand Down Expand Up @@ -2146,16 +2145,15 @@ def new_comment_reply(cls, user_id, comment_user_id, reply_content, story_feed_i

@classmethod
def new_comment_like(cls, liking_user_id, comment_user_id, social_feed_id, story_id, story_title, comments):
params = {
'user_id': comment_user_id,
'with_user_id': liking_user_id,
'category': 'comment_like',
'feed_id': social_feed_id,
'content_id': story_id,
'title': story_title,
'content': comments,
}
cls.objects.create(**params)
cls.objects.get_or_create(user_id=comment_user_id,
with_user_id=liking_user_id,
category="comment_like",
feed_id=social_feed_id,
content_id=story_id,
defaults={
"title": story_title,
"content": comments,
})

@classmethod
def new_shared_story(cls, user_id, story_title, comments, story_feed_id, story_id, share_date=None):
Expand Down
1 change: 1 addition & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,4 +436,5 @@ def custom_show_toolbar(request):
if DEBUG:
MIDDLEWARE_CLASSES += ('utils.mongo_raw_log_middleware.SqldumpMiddleware',)
MIDDLEWARE_CLASSES += ('utils.redis_raw_log_middleware.SqldumpMiddleware',)
MIDDLEWARE_CLASSES += ('utils.request_introspection_middleware.DumpRequestMiddleware',)

9 changes: 9 additions & 0 deletions utils/request_introspection_middleware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.conf import settings
from utils import log as logging

class DumpRequestMiddleware:
def process_request(self, request):
if settings.DEBUG:
request_items = request.REQUEST.items()
if request_items:
logging.debug("~BC~FK%s" % dict(request_items))

0 comments on commit ff43983

Please sign in to comment.