def _create_new_bookmark_bbs(user_id,bbs): data=StackFeedData() data.feed_mode="new_bookmark_bbs" data.from_user_id=user_id data.to_user_id=None data.user_key=None data.bbs_key=bbs data.thread_key=None data.message="" data.create_date=datetime.datetime.today() data.put() return data
def _create_new_thread(user,bbs,thread): data=StackFeedData() data.feed_mode="bbs_new_illust" data.from_user_id=thread.user_id data.to_user_id=None data.user_key=None data.bbs_key=bbs data.thread_key=thread data.message="" data.create_date=datetime.datetime.today() data.put() return data
def _create_new_follow(user_id,add_user_key): data=StackFeedData() data.feed_mode="new_follow" data.from_user_id=user_id data.to_user_id=None data.user_key=add_user_key data.bbs_key=None data.thread_key=None data.message="" data.create_date=datetime.datetime.today() data.put() return data
def _create_new_bookmark_thread(user_id,thread,comment): data=StackFeedData() data.feed_mode="new_bookmark_thread" data.from_user_id=user_id data.to_user_id=None data.user_key=None data.bbs_key=thread.bbs_key data.thread_key=thread data.message="" if(comment): data.message=comment data.create_date=datetime.datetime.today() data.put() return data
def _create_new_comment_thread(user_id,thread,entry,res): data=StackFeedData() data.feed_mode="new_comment_thread" data.from_user_id=user_id data.to_user_id=None data.user_key=None data.bbs_key=thread.bbs_key data.thread_key=thread data.entry_key=entry data.response_key=res data.message="" data.create_date=datetime.datetime.today() data.put() return data
def add_new_message(self,user): #メッセージ作成 data=StackFeedData() data.feed_mode="message" data.from_user_id=user.user_id() if(self.request.get("to_user_id")): data.to_user_id=self.request.get("to_user_id") else: data.to_user_id=None data.user_key=None data.bbs_key=None data.thread_key=None data.message=self.request.get("message") if(data.message==""): self.response.out.write(Alert.alert_msg("書き込みメッセージが存在しません。",self.request.host)); return False data.create_date=datetime.datetime.today() #二重投稿防止 message=memcache.get("StackFeedTweet") if(message==self.request.get("message")): self.response.out.write(Alert.alert_msg("このメッセージは既に投稿されています。",self.request.host)); return False memcache.set("StackFeedTweet",self.request.get("message"),5) #保存 data.put() #トップページ用ログ格納 recent=StackFeedDataRecent.get_or_insert(data.from_user_id) recent.message=data.message recent.from_user_id=data.from_user_id recent.to_user_id=data.to_user_id recent.put() #自分と相手にフィード StackFeed._append_one(data,user.user_id()) if(data.to_user_id): StackFeed._append_one(data,data.to_user_id) #フォロワーにフィード StackFeed.feed_new_message(user,data) return True