##// END OF EJS Templates
feeds: generate entries with proper unique ids....
ergo -
r2071:263f1c18 default
parent child Browse files
Show More
@@ -37,7 +37,7 b' import rhodecode.lib.helpers as h'
37 37 from rhodecode.lib.helpers import Page
38 38 from rhodecode.lib.user_log_filter import user_log_filter
39 39 from rhodecode.lib.auth import LoginRequired, NotAnonymous, CSRFRequired
40 from rhodecode.lib.utils2 import safe_int, AttributeDict
40 from rhodecode.lib.utils2 import safe_int, AttributeDict, md5_safe
41 41 from rhodecode.model.scm import ScmModel
42 42
43 43 log = logging.getLogger(__name__)
@@ -121,6 +121,9 b' class JournalView(BaseAppView):'
121 121
122 122 return journal
123 123
124 def feed_uid(self, entry_id):
125 return '{}:{}'.format('journal', md5_safe(entry_id))
126
124 127 def _atom_feed(self, repos, search_term, public=True):
125 128 _ = self.request.translate
126 129 journal = self._get_journal_data(repos, search_term)
@@ -152,12 +155,14 b' class JournalView(BaseAppView):'
152 155 _url = h.route_url('repo_changelog',
153 156 repo_name=entry.repository.repo_name)
154 157
155 feed.add_item(title=title,
156 pubdate=entry.action_date,
157 link=_url,
158 author_email=user.email,
159 author_name=user.full_contact,
160 description=desc)
158 feed.add_item(
159 unique_id=self.feed_uid(entry.user_log_id),
160 title=title,
161 pubdate=entry.action_date,
162 link=_url,
163 author_email=user.email,
164 author_name=user.full_contact,
165 description=desc)
161 166
162 167 response = Response(feed.writeString('utf-8'))
163 168 response.content_type = feed.mime_type
@@ -195,12 +200,14 b' class JournalView(BaseAppView):'
195 200 _url = h.route_url('repo_changelog',
196 201 repo_name=entry.repository.repo_name)
197 202
198 feed.add_item(title=title,
199 pubdate=entry.action_date,
200 link=_url,
201 author_email=user.email,
202 author_name=user.full_contact,
203 description=desc)
203 feed.add_item(
204 unique_id=self.feed_uid(entry.user_log_id),
205 title=title,
206 pubdate=entry.action_date,
207 link=_url,
208 author_email=user.email,
209 author_name=user.full_contact,
210 description=desc)
204 211
205 212 response = Response(feed.writeString('utf-8'))
206 213 response.content_type = feed.mime_type
@@ -32,7 +32,7 b' from rhodecode.lib import helpers as h'
32 32 from rhodecode.lib.auth import (
33 33 LoginRequired, HasRepoPermissionAnyDecorator)
34 34 from rhodecode.lib.diffs import DiffProcessor, LimitedDiffContainer
35 from rhodecode.lib.utils2 import str2bool, safe_int
35 from rhodecode.lib.utils2 import str2bool, safe_int, md5_safe
36 36 from rhodecode.model.db import UserApiKeys, CacheKey
37 37
38 38 log = logging.getLogger(__name__)
@@ -109,6 +109,9 b' class RepoFeedView(RepoAppView):'
109 109 def _get_commits(self):
110 110 return list(self.rhodecode_vcs_repo[-self.feed_items_per_page:])
111 111
112 def uid(self, repo_id, commit_id):
113 return '{}:{}'.format(md5_safe(repo_id), md5_safe(commit_id))
114
112 115 @LoginRequired(auth_token_access=[UserApiKeys.ROLE_FEED])
113 116 @HasRepoPermissionAnyDecorator(
114 117 'repository.read', 'repository.write', 'repository.admin')
@@ -134,6 +137,7 b' class RepoFeedView(RepoAppView):'
134 137 for commit in reversed(self._get_commits()):
135 138 date = self._set_timezone(commit.date)
136 139 feed.add_item(
140 unique_id=self.uid(self.db_repo.repo_id, commit.raw_id),
137 141 title=self._get_title(commit),
138 142 author_name=commit.author,
139 143 description=self._get_description(commit),
@@ -180,6 +184,7 b' class RepoFeedView(RepoAppView):'
180 184 for commit in reversed(self._get_commits()):
181 185 date = self._set_timezone(commit.date)
182 186 feed.add_item(
187 unique_id=self.uid(self.db_repo.repo_id, commit.raw_id),
183 188 title=self._get_title(commit),
184 189 author_name=commit.author,
185 190 description=self._get_description(commit),
General Comments 0
You need to be logged in to leave comments. Login now