Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | # 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.""" |
| 7 | from __future__ import print_function |
| 8 | from __future__ import division |
| 9 | from __future__ import absolute_import |
| 10 | |
| 11 | import logging |
| 12 | |
| 13 | import ezt |
| 14 | |
| 15 | from features import activities |
| 16 | from framework import servlet |
| 17 | from framework import urls |
| 18 | |
| 19 | |
| 20 | class 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) |