##// 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,7 +155,9 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,
158 feed.add_item(
159 unique_id=self.feed_uid(entry.user_log_id),
160 title=title,
156 161 pubdate=entry.action_date,
157 162 link=_url,
158 163 author_email=user.email,
@@ -195,7 +200,9 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,
203 feed.add_item(
204 unique_id=self.feed_uid(entry.user_log_id),
205 title=title,
199 206 pubdate=entry.action_date,
200 207 link=_url,
201 208 author_email=user.email,
@@ -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