def activities(self, request): start = request.get_form_var('start', '0') limit = request.get_form_var('count', '20') if start.isdigit() and limit.isdigit(): start = int(start) limit = int(limit) else: start = 0 limit = 20 activities = get_user_feed(self.user.username).get_actions( start, limit) return [format_timeline(activity) for activity in activities]
def yours(request): user = request.user actions = (get_user_feed(user.username) .get_actions(stop=PAGE_ACTIONS_COUNT - 1)) your_projects = CodeDoubanProject.get_projects( owner=user.username, sortby="lru") watched_projects = CodeDoubanProject.get_watched_others_projects_by_user( user=user.username, sortby='lru') badge_items = user.get_badge_items() return st('my_actions.html', **locals())
def yours(request): user = request.user actions = (get_user_feed( user.username).get_actions(stop=PAGE_ACTIONS_COUNT - 1)) your_projects = CodeDoubanProject.get_projects(owner=user.username, sortby="lru") watched_projects = CodeDoubanProject.get_watched_others_projects_by_user( user=user.username, sortby='lru') badge_items = user.get_badge_items() return st('my_actions.html', **locals())
def _q_index(self, request): name = self.name your_projects = CodeDoubanProject.get_projects(owner=name, sortby="lru") actions = get_user_feed(name).get_actions(0, 20) user = User(name) teams = Team.get_by_user_id(user.name) badge_items = user.get_badge_items() followers_count = user.followers_count following_count = user.following_count if user and user.username == name and user.get_new_badges(): user.clear_new_badges() return st("people.html", **locals())
def _q_index(self, request): name = self.name your_projects = CodeDoubanProject.get_projects(owner=name, sortby='lru') actions = get_user_feed(name).get_actions(0, 20) user = User(name) teams = Team.get_by_user_id(user.name) badge_items = user.get_badge_items() followers_count = user.followers_count following_count = user.following_count if user and user.username == name and user.get_new_badges(): user.clear_new_badges() return st('people.html', **locals())
def test_userinbox(self): actor = 'testuser1' all_feed = [ get_user_inbox(actor), get_user_feed(actor), get_public_feed(), ] data = dict(type='pull_request', owner='testuser2', url='', title='pr title', description='pr desc', date=datetime.now(), from_proj='10', to_proj='1', uid='pullrequest-1-1-unmerge') for feed in all_feed: feed.add_action(data) actions = feed.get_actions() assert len(actions) == 1