def post(self): user = util.get_current_user() if not user: self.redirect(util.create_login_url(self.request.uri)) return if not is_honeypot_empty(self.request): # Honeypot caught a spammer (in case this is ever public or spammers # have google accounts)! return question_text = self.request.get("question_text") video_key = self.request.get("video_key") playlist_key = self.request.get("playlist_key") video = db.get(video_key) if question_text and video: if len(question_text) > 500: question_text = question_text[0:500] # max question length, also limited by client question = models_discussion.Feedback() question.author = user question.content = question_text question.targets = [video.key()] question.types = [models_discussion.FeedbackType.Question] db.put(question) self.redirect("/discussion/pagequestions?video_key=%s&playlist_key=%s&page=0" % (video_key, playlist_key))
def post(self): user = util.get_current_user() if not user: self.redirect(util.create_login_url(self.request.uri)) return if not is_honeypot_empty(self.request): # Honeypot caught a spammer (in case this is ever public or spammers # have google accounts)! return comment_text = self.request.get("comment_text") comments_hidden = self.request.get("comments_hidden") video_key = self.request.get("video_key") playlist_key = self.request.get("playlist_key") video = db.get(video_key) if comment_text and video: if len(comment_text) > 300: comment_text = comment_text[0:300] # max comment length, also limited by client comment = models_discussion.Feedback() comment.author = user comment.content = comment_text comment.targets = [video.key()] comment.types = [models_discussion.FeedbackType.Comment] db.put(comment) self.redirect("/discussion/pagecomments?video_key=%s&playlist_key=%s&page=0&comments_hidden=%s" % (video_key, playlist_key, comments_hidden))
def post(self): user_data = models.UserData.current() if not user_data: self.redirect(util.create_login_url(self.request.uri)) return if not util_discussion.is_honeypot_empty(self.request): # Honeypot caught a spammer (in case this is ever public or spammers # have google accounts)! return comment_text = self.request.get("comment_text") comments_hidden = self.request.get("comments_hidden") video_key = self.request.get("video_key") playlist_key = self.request.get("playlist_key") video = db.get(video_key) if comment_text and video: if len(comment_text) > 300: comment_text = comment_text[ 0:300] # max comment length, also limited by client comment = models_discussion.Feedback(parent=user_data) comment.set_author(user_data) comment.content = comment_text comment.targets = [video.key()] comment.types = [models_discussion.FeedbackType.Comment] comment.put() self.redirect( "/discussion/pagecomments?video_key=%s&playlist_key=%s&page=0&comments_hidden=%s&sort_order=%s" % (video_key, playlist_key, comments_hidden, voting.VotingSortOrder.NewestFirst))
def post(self): user_data = models.UserData.current() if not user_data: self.redirect(util.create_login_url(self.request.uri)) return if not util_discussion.is_honeypot_empty(self.request): # Honeypot caught a spammer (in case this is ever public or spammers # have google accounts)! return answer_text = self.request.get("answer_text") video_key = self.request.get("video_key") question_key = self.request.get("question_key") video = db.get(video_key) question = db.get(question_key) if answer_text and video and question: answer = models_discussion.Feedback(parent=user_data) answer.set_author(user_data) answer.content = answer_text answer.targets = [video.key(), question.key()] answer.types = [models_discussion.FeedbackType.Answer] if user_data.discussion_banned: # Hellbanned users' posts are automatically hidden answer.deleted = True # We don't limit answer.content length, which means we're vulnerable to # RequestTooLargeErrors being thrown if somebody submits a POST over the GAE # limit of 1MB per entity. This is *highly* unlikely for a legitimate piece of feedback, # and we're choosing to crash in this case until someone legitimately runs into this. # See Issue 841. answer.put() if not answer.deleted: notification.new_answer_for_video_question( video, question, answer) self.redirect("/discussion/answers?question_key=%s" % question_key)
def post(self): user_data = models.UserData.current() if not user_data: self.redirect(util.create_login_url(self.request.uri)) return if not util_discussion.is_honeypot_empty(self.request): # Honeypot caught a spammer (in case this is ever public or spammers # have google accounts)! return question_text = self.request.get("question_text") video_key = self.request.get("video_key") topic_key = self.request.get("topic_key") video = db.get(video_key) question_key = "" if question_text and video: if len(question_text) > 500: question_text = question_text[ 0:500] # max question length, also limited by client question = models_discussion.Feedback(parent=user_data) question.set_author(user_data) question.content = question_text question.targets = [video.key()] question.types = [models_discussion.FeedbackType.Question] if user_data.discussion_banned: # Hellbanned users' posts are automatically hidden question.deleted = True question.put() question_key = question.key() self.redirect( "/discussion/pagequestions?video_key=%s&topic_key=%s&qa_expand_key=%s" % (video_key, topic_key, question_key))