mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Preventing dupe favorites from showing up in activities and interactions.
This commit is contained in:
parent
dffdfa75a6
commit
ff439834c5
3 changed files with 28 additions and 20 deletions
|
@ -1967,16 +1967,15 @@ class MInteraction(mongo.Document):
|
|||
|
||||
@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 @@ class MActivity(mongo.Document):
|
|||
|
||||
@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):
|
||||
|
|
|
@ -436,4 +436,5 @@ JAMMIT = jammit.JammitAssets(NEWSBLUR_DIR)
|
|||
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
utils/request_introspection_middleware.py
Normal file
9
utils/request_introspection_middleware.py
Normal file
|
@ -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))
|
Loading…
Add table
Reference in a new issue