Ejemplo n.º 1
0
 def comment_toggle_dislike(self, request):
     user = endpoints.get_current_user()
     comment = Comment.get_Comment(request.value)
     if not (user and comment):
         return API.BooleanMessage(value=False)
     comment.toggle_dislike(user.email())
     return API.BooleanMessage(value=True)
Ejemplo n.º 2
0
 def comment_delete(self, request):
     user = endpoints.get_current_user()
     comment = Comment.get_Comment(request.value)
     if not (user and comment and user.email() == comment.author_email):
         return API.BooleanMessage(value=False)
     comment.delete()
     return API.BooleanMessage(value=True)
Ejemplo n.º 3
0
 def comment_get_replies(self, request):
     comment = Comment.get_Comment(request.value)
     if not comment:
         return comment_reply_api.MultiCommentReplyResponse(comment_replies=[])
     replies = [comment_reply_api.createCommentReplyMessage(reply) for reply in comment.get_replies()]
     return comment_reply_api.MultiCommentReplyResponse(comment_replies=replies)
Ejemplo n.º 4
0
 def comment_get(self, request):
     comment = Comment.get_Comment(request.value)
     if not comment:
         return CommentResponse()
     return CommentResponse(comment=createCommentMessage(comment))
Ejemplo n.º 5
0
 def comment_reply(self, request):
     user = endpoints.get_current_user()
     comment = Comment.get_Comment(request.id)
     if not (user and comment):
         return API.IntegerMessage(value=-1)
     return API.IntegerMessage(value=comment.reply(user.email(), request.content))