Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Preventing dupe favorites from showing up in activities and interacti…

…ons.
  • Loading branch information...
commit ff439834c564dadec4012db0ed11a880d9b90543 1 parent dffdfa7
@samuelclay authored
View
38 apps/social/models.py
@@ -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):
@@ -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):
View
1  settings.py
@@ -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',)
View
9 utils/request_introspection_middleware.py
@@ -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))
Please sign in to comment.
Something went wrong with that request. Please try again.