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