mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
Fixing interactions on favorites, replies (to include titles), and wording in api docs.
This commit is contained in:
parent
8eb106612a
commit
dffdfa75a6
4 changed files with 32 additions and 26 deletions
|
@ -1400,7 +1400,7 @@ def send_story_email(request):
|
|||
code = -1
|
||||
message = 'You need to provide your name.'
|
||||
else:
|
||||
story = MStory.objects(story_feed_id=feed_id, story_guid=story_id)[0]
|
||||
story = MStory.find_story(story_feed_id=feed_id, story_guid=story_id)
|
||||
story = Feed.format_story(story, feed_id, text=True)
|
||||
feed = Feed.objects.get(pk=story['story_feed_id'])
|
||||
text = render_to_string('mail/email_story_text.xhtml', locals())
|
||||
|
|
|
@ -1942,13 +1942,14 @@ class MInteraction(mongo.Document):
|
|||
dupe.delete()
|
||||
|
||||
@classmethod
|
||||
def new_comment_reply(cls, user_id, reply_user_id, reply_content, social_feed_id, story_id, original_message=None):
|
||||
def new_comment_reply(cls, user_id, reply_user_id, reply_content, social_feed_id, story_id, story_title=None, original_message=None):
|
||||
params = {
|
||||
'user_id': user_id,
|
||||
'with_user_id': reply_user_id,
|
||||
'category': 'comment_reply',
|
||||
'content': reply_content,
|
||||
'feed_id': social_feed_id,
|
||||
'title': story_title,
|
||||
'content_id': story_id,
|
||||
}
|
||||
if original_message:
|
||||
|
@ -1965,26 +1966,27 @@ class MInteraction(mongo.Document):
|
|||
cls.objects.create(**params)
|
||||
|
||||
@classmethod
|
||||
def new_comment_like(cls, user_id, comment_user_id, story_feed_id, story_id, story_title, comments):
|
||||
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': user_id,
|
||||
'with_user_id': liking_user_id,
|
||||
'category': 'comment_like',
|
||||
'title': story_title,
|
||||
'feed_id': story_feed_id,
|
||||
'feed_id': social_feed_id,
|
||||
'content_id': story_id,
|
||||
'title': story_title,
|
||||
'content': comments,
|
||||
}
|
||||
cls.objects.create(**params)
|
||||
|
||||
@classmethod
|
||||
def new_reply_reply(cls, user_id, reply_user_id, reply_content, social_feed_id, story_id, original_message=None):
|
||||
def new_reply_reply(cls, user_id, reply_user_id, reply_content, social_feed_id, story_id, story_title=None, original_message=None):
|
||||
params = {
|
||||
'user_id': user_id,
|
||||
'with_user_id': reply_user_id,
|
||||
'category': 'reply_reply',
|
||||
'content': reply_content,
|
||||
'feed_id': social_feed_id,
|
||||
'title': story_title,
|
||||
'content_id': story_id,
|
||||
}
|
||||
if original_message:
|
||||
|
@ -2119,13 +2121,14 @@ class MActivity(mongo.Document):
|
|||
dupe.delete()
|
||||
|
||||
@classmethod
|
||||
def new_comment_reply(cls, user_id, comment_user_id, reply_content, story_feed_id, story_id, original_message=None):
|
||||
def new_comment_reply(cls, user_id, comment_user_id, reply_content, story_feed_id, story_id, story_title=None, original_message=None):
|
||||
params = {
|
||||
'user_id': user_id,
|
||||
'with_user_id': comment_user_id,
|
||||
'category': 'comment_reply',
|
||||
'content': reply_content,
|
||||
'feed_id': story_feed_id,
|
||||
'title': story_title,
|
||||
'content_id': story_id,
|
||||
}
|
||||
if original_message:
|
||||
|
@ -2142,12 +2145,12 @@ class MActivity(mongo.Document):
|
|||
cls.objects.create(**params)
|
||||
|
||||
@classmethod
|
||||
def new_comment_like(cls, user_id, comment_user_id, story_feed_id, story_id, story_title, comments):
|
||||
def new_comment_like(cls, liking_user_id, comment_user_id, social_feed_id, story_id, story_title, comments):
|
||||
params = {
|
||||
'user_id': user_id,
|
||||
'with_user_id': comment_user_id,
|
||||
'user_id': comment_user_id,
|
||||
'with_user_id': liking_user_id,
|
||||
'category': 'comment_like',
|
||||
'feed_id': story_feed_id,
|
||||
'feed_id': social_feed_id,
|
||||
'content_id': story_id,
|
||||
'title': story_title,
|
||||
'content': comments,
|
||||
|
|
|
@ -435,9 +435,9 @@ def save_comment_reply(request):
|
|||
story_id = request.POST['story_id']
|
||||
comment_user_id = request.POST['comment_user_id']
|
||||
reply_comments = request.POST.get('reply_comments')
|
||||
original_message = request.POST.get('original_message')
|
||||
reply_id = request.POST.get('reply_id')
|
||||
format = request.REQUEST.get('format', 'json')
|
||||
original_message = None
|
||||
|
||||
if not reply_comments:
|
||||
return json.json_response(request, {'code': -1, 'message': 'Reply comments cannot be empty.'})
|
||||
|
@ -484,14 +484,16 @@ def save_comment_reply(request):
|
|||
reply_content=reply_comments,
|
||||
original_message=original_message,
|
||||
story_feed_id=feed_id,
|
||||
story_id=story_id)
|
||||
story_id=story_id,
|
||||
story_title=shared_story.story_title)
|
||||
if comment['user_id'] != request.user.pk:
|
||||
MInteraction.new_comment_reply(user_id=comment['user_id'],
|
||||
reply_user_id=request.user.pk,
|
||||
reply_content=reply_comments,
|
||||
original_message=original_message,
|
||||
social_feed_id=comment_user_id,
|
||||
story_id=story_id)
|
||||
story_id=story_id,
|
||||
story_title=shared_story.story_title)
|
||||
|
||||
for user_id in set(reply_user_ids).difference([comment['user_id']]):
|
||||
if request.user.pk != user_id:
|
||||
|
@ -500,7 +502,8 @@ def save_comment_reply(request):
|
|||
reply_content=reply_comments,
|
||||
original_message=original_message,
|
||||
social_feed_id=comment_user_id,
|
||||
story_id=story_id)
|
||||
story_id=story_id,
|
||||
story_title=shared_story.story_title)
|
||||
|
||||
EmailCommentReplies.apply_async(kwargs=dict(shared_story_id=shared_story.id,
|
||||
reply_id=reply.reply_id), countdown=60)
|
||||
|
@ -744,15 +747,15 @@ def like_comment(request):
|
|||
shared_story.comments[:30],
|
||||
))
|
||||
|
||||
MActivity.new_comment_like(user_id=request.user.pk,
|
||||
MActivity.new_comment_like(liking_user_id=request.user.pk,
|
||||
comment_user_id=comment['user_id'],
|
||||
story_feed_id=feed_id,
|
||||
social_feed_id=comment['user_id'],
|
||||
story_id=story_id,
|
||||
story_title=shared_story.story_title,
|
||||
comments=shared_story.comments)
|
||||
MInteraction.new_comment_like(user_id=request.user.pk,
|
||||
comment_user_id=comment_user_id,
|
||||
story_feed_id=feed_id,
|
||||
MInteraction.new_comment_like(liking_user_id=request.user.pk,
|
||||
comment_user_id=comment['user_id'],
|
||||
social_feed_id=comment['user_id'],
|
||||
story_id=story_id,
|
||||
story_title=shared_story.story_title,
|
||||
comments=shared_story.comments)
|
||||
|
|
|
@ -342,7 +342,7 @@
|
|||
optional: true
|
||||
example: "['twitter', 'facebook']"
|
||||
- key: format
|
||||
desc: "Return a JSON or HTML template"
|
||||
desc: "Return JSON or a HTML template"
|
||||
optional: true
|
||||
default: "json"
|
||||
example: "html"
|
||||
|
@ -363,7 +363,7 @@
|
|||
required: true
|
||||
example: "http://blog.newsblur.com/post/1"
|
||||
- key: format
|
||||
desc: "Return a JSON or HTML template"
|
||||
desc: "Return JSON or a HTML template"
|
||||
optional: true
|
||||
default: "json"
|
||||
example: "html"
|
||||
|
@ -537,7 +537,7 @@
|
|||
optional: true
|
||||
example: "5000...0042"
|
||||
- key: format
|
||||
desc: "Return a JSON or HTML template"
|
||||
desc: "Return JSON or a HTML template"
|
||||
optional: true
|
||||
default: "json"
|
||||
example: "html"
|
||||
|
@ -561,7 +561,7 @@
|
|||
required: true
|
||||
example: "64"
|
||||
- key: format
|
||||
desc: "Return a JSON or HTML template"
|
||||
desc: "Return JSON or a HTML template"
|
||||
optional: true
|
||||
default: "json"
|
||||
example: "html"
|
||||
|
@ -584,7 +584,7 @@
|
|||
required: true
|
||||
example: "64"
|
||||
- key: format
|
||||
desc: "Return a JSON or HTML template"
|
||||
desc: "Return JSON or a HTML template"
|
||||
optional: true
|
||||
default: "json"
|
||||
example: "html"
|
||||
|
|
Loading…
Add table
Reference in a new issue