blob: bd1e316f7b3851a28d9c5f1a6bb7420d561aa522 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file or at
4# https://developers.google.com/open-source/licenses/bsd
5
6"""A class to display a paginated list of activity stream updates."""
7from __future__ import print_function
8from __future__ import division
9from __future__ import absolute_import
10
11import logging
12
13import ezt
14
15from features import activities
16from framework import servlet
17from framework import urls
18
19
20class ProjectUpdates(servlet.Servlet):
21 """ProjectUpdates page shows a list of past activities."""
22
23 _PAGE_TEMPLATE = 'project/project-updates-page.ezt'
24 _MAIN_TAB_MODE = servlet.Servlet.MAIN_TAB_UPDATES
25
26 def GatherPageData(self, mr):
27 """Build up a dictionary of data values to use when rendering the page."""
28
29 page_data = self._GatherUpdates(mr)
30 page_data['subtab_mode'] = None
31 page_data['user_updates_tab_mode'] = None
32 logging.info('project updates data is %r', page_data)
33 return page_data
34
35 def _GatherUpdates(self, mr):
36 """Gathers and returns activity streams data."""
37
38 url = '/p/%s%s' % (mr.project_name, urls.UPDATES_LIST)
39 return activities.GatherUpdatesData(
40 self.services, mr, project_ids=[mr.project_id],
41 ending='by_user', updates_page_url=url,
42 autolink=self.services.autolink)