Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 1 | # Copyright 2016 The Chromium Authors |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 4 | |
| 5 | """A class to display a paginated list of activity stream updates.""" |
| 6 | from __future__ import print_function |
| 7 | from __future__ import division |
| 8 | from __future__ import absolute_import |
| 9 | |
| 10 | import logging |
| 11 | |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 12 | from features import activities |
| 13 | from framework import servlet |
| 14 | from framework import urls |
| 15 | |
| 16 | |
| 17 | class ProjectUpdates(servlet.Servlet): |
| 18 | """ProjectUpdates page shows a list of past activities.""" |
| 19 | |
| 20 | _PAGE_TEMPLATE = 'project/project-updates-page.ezt' |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 21 | _MAIN_TAB_MODE = servlet.Servlet.MAIN_TAB_UPDATES |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 22 | |
| 23 | def GatherPageData(self, mr): |
| 24 | """Build up a dictionary of data values to use when rendering the page.""" |
| 25 | |
| 26 | page_data = self._GatherUpdates(mr) |
| 27 | page_data['subtab_mode'] = None |
| 28 | page_data['user_updates_tab_mode'] = None |
| 29 | logging.info('project updates data is %r', page_data) |
| 30 | return page_data |
| 31 | |
| 32 | def _GatherUpdates(self, mr): |
| 33 | """Gathers and returns activity streams data.""" |
| 34 | |
| 35 | url = '/p/%s%s' % (mr.project_name, urls.UPDATES_LIST) |
| 36 | return activities.GatherUpdatesData( |
| 37 | self.services, mr, project_ids=[mr.project_id], |
| 38 | ending='by_user', updates_page_url=url, |
| 39 | autolink=self.services.autolink) |
Adrià Vilanova Martínez | de94280 | 2022-07-15 14:06:55 +0200 | [diff] [blame] | 40 | |
Adrià Vilanova Martínez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame^] | 41 | def GetProjectUpdatesPage(self, **kwargs): |
| 42 | return self.handler(**kwargs) |