Пример #1
0
    def get(self, user_id=None):
        user_id = user_id or self.current_user["_id"]

        kwargs = yield self.get_header_arguments(user_id)
        if not kwargs['can_seen']:
            self.render('profile/template/profile-visitor.html', **kwargs)
        else:
            messages_func = LeaveMessageDocument.get_leave_message_list
            leave_message_list = yield messages_func(
                user_id, self.current_user['_id'],
                limit=PROFILE_SETTINGS['leave_message_number_per_page']
            )

            kwargs.update({
                'leave_message_list': leave_message_list
            })

            if ObjectId(user_id) == ObjectId(self.current_user['_id']):
                yield MessageDocument.set_read(
                    user_id, MessageTopic.LEAVE_MESSAGE_NEW
                )

            self.render(
                'profile/template/leavemessage/leavemessage.html',
                **kwargs
            )
Пример #2
0
    def get(self):
        form = MessageForm(self.request.arguments)
        if not form.validate():
            raise HTTPError(404)

        category = form.category.data

        kwargs = yield self.get_sidebar_arguments()

        if category == MessageTopic.CHAT_MESSAGE_NEW:
            message_list = yield ChatMessageDocument.get_chat_message_list(
                self.current_user['_id'],
                limit=HOME_SETTINGS['message_number_per_page']
            )
        else:
            message_list = yield MessageDocument.get_message_list(
                self.current_user['_id'],
                message_topic=category,
                limit=HOME_SETTINGS['message_number_per_page']
            )

            yield MessageDocument.set_read(self.current_user['_id'], category)

        kwargs.update({
            'message_list': message_list,
            'category': category
        })

        self.render('home/template/message/message.html', **kwargs)
Пример #3
0
    def get(self):
        form = MessageForm(self.request.arguments)
        if not form.validate():
            raise HTTPError(404)

        category = form.category.data

        kwargs = yield self.get_sidebar_arguments()

        if category == MessageTopic.CHAT_MESSAGE_NEW:
            message_list = yield ChatMessageDocument.get_chat_message_list(
                self.current_user['_id'],
                limit=HOME_SETTINGS['message_number_per_page']
            )
        else:
            message_list = yield MessageDocument.get_message_list(
                self.current_user['_id'],
                message_topic=category,
                limit=HOME_SETTINGS['message_number_per_page']
            )

            yield MessageDocument.set_read(self.current_user['_id'], category)

        kwargs.update({
            'message_list': message_list,
            'category': category
        })

        self.render('home/template/message/message.html', **kwargs)
Пример #4
0
    def get(self, user_id=None):
        user_id = user_id or self.current_user["_id"]

        kwargs = yield self.get_header_arguments(user_id)
        if not kwargs['can_seen']:
            self.render('profile/template/profile-visitor.html', **kwargs)
        else:
            messages_func = LeaveMessageDocument.get_leave_message_list
            leave_message_list = yield messages_func(
                user_id,
                self.current_user['_id'],
                limit=PROFILE_SETTINGS['leave_message_number_per_page'])

            kwargs.update({'leave_message_list': leave_message_list})

            if ObjectId(user_id) == ObjectId(self.current_user['_id']):
                yield MessageDocument.set_read(user_id,
                                               MessageTopic.LEAVE_MESSAGE_NEW)

            self.render('profile/template/leavemessage/leavemessage.html',
                        **kwargs)