blob: 7a0928a80e27758b646f055ca223e548eff3d79a [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001# 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.
Copybara854996b2021-09-07 19:36:02 +00004
5"""A class to display a paginated list of activity stream updates."""
6from __future__ import print_function
7from __future__ import division
8from __future__ import absolute_import
9
10import logging
11
Copybara854996b2021-09-07 19:36:02 +000012from features import activities
13from framework import servlet
14from framework import urls
15
16
17class ProjectUpdates(servlet.Servlet):
18 """ProjectUpdates page shows a list of past activities."""
19
20 _PAGE_TEMPLATE = 'project/project-updates-page.ezt'
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +010021 _MAIN_TAB_MODE = servlet.Servlet.MAIN_TAB_UPDATES
Copybara854996b2021-09-07 19:36:02 +000022
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ínezde942802022-07-15 14:06:55 +020040
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +010041 def GetProjectUpdatesPage(self, **kwargs):
42 return self.handler(**kwargs)