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 |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame^] | 16 | from framework import flaskservlet |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 17 | from framework import servlet |
| 18 | from framework import urls |
| 19 | |
| 20 | |
| 21 | class ProjectUpdates(servlet.Servlet): |
| 22 | """ProjectUpdates page shows a list of past activities.""" |
| 23 | |
| 24 | _PAGE_TEMPLATE = 'project/project-updates-page.ezt' |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame^] | 25 | _MAIN_TAB_MODE = flaskservlet.FlaskServlet.MAIN_TAB_UPDATES |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 26 | |
| 27 | def GatherPageData(self, mr): |
| 28 | """Build up a dictionary of data values to use when rendering the page.""" |
| 29 | |
| 30 | page_data = self._GatherUpdates(mr) |
| 31 | page_data['subtab_mode'] = None |
| 32 | page_data['user_updates_tab_mode'] = None |
| 33 | logging.info('project updates data is %r', page_data) |
| 34 | return page_data |
| 35 | |
| 36 | def _GatherUpdates(self, mr): |
| 37 | """Gathers and returns activity streams data.""" |
| 38 | |
| 39 | url = '/p/%s%s' % (mr.project_name, urls.UPDATES_LIST) |
| 40 | return activities.GatherUpdatesData( |
| 41 | self.services, mr, project_ids=[mr.project_id], |
| 42 | ending='by_user', updates_page_url=url, |
| 43 | autolink=self.services.autolink) |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame^] | 44 | |
| 45 | # def GetProjectUpdatesPage(self, **kwargs): |
| 46 | # return self.handler(**kwargs) |