Example #1
0
    def to_message(self, team_key=None, auth_user=None):
        """
        Convert FollowUp data model to follow up message.
        """
        message = FollowupMessage()
        message.id = self.key.id()
        message.anno_id = self.anno_key.id()
        message.comment = self.comment
        message.created = self.created

        message.tagged_users_detail = []
        for user in self.tagged_users:
            user_info = User.get_by_id(int(user))
            is_auth_user = (user_info.user_email == auth_user.user_email) if auth_user else False
            message.tagged_users_detail.append(UserMessage(id=user_info.key.id(),
                                                           display_name=user_info.display_name,
                                                           user_email=user_info.user_email,
                                                           image_url=user_info.image_url,
                                                           is_auth_user=is_auth_user))

        if self.creator is not None:
            user_info = self.creator.get()
            message.creator = UserMessage(display_name=user_info.display_name, image_url=user_info.image_url)

        return message
Example #2
0
 def to_message(self):
     """
     Convert FollowUp data model to follow up message.
     """
     message = FollowupMessage()
     message.id = self.key.id()
     message.anno_id = self.anno_key.id()
     message.user_id = self.creator.id()
     message.comment = self.comment
     message.created = self.created
     return message
Example #3
0
 def to_message(self):
     """
     Convert FollowUp data model to follow up message.
     """
     message = FollowupMessage()
     message.id = self.key.id()
     message.anno_id = self.anno_key.id()
     message.comment = self.comment
     message.created = self.created
     if self.creator is not None:
         message.creator = self.creator.get().to_message()
     return message