Show More
@@ -25,10 +25,9 b' journal controller for pylons' | |||||
25 |
|
25 | |||
26 | from pylons import request, response, session, tmpl_context as c, url |
|
26 | from pylons import request, response, session, tmpl_context as c, url | |
27 | from pylons.controllers.util import abort, redirect |
|
27 | from pylons.controllers.util import abort, redirect | |
28 | from rhodecode.lib.auth import LoginRequired |
|
28 | from rhodecode.lib.auth import LoginRequired, NotAnonymous | |
29 | from rhodecode.lib.base import BaseController, render |
|
29 | from rhodecode.lib.base import BaseController, render | |
30 | from rhodecode.lib.helpers import get_token |
|
30 | from rhodecode.lib.helpers import get_token | |
31 | from rhodecode.lib.utils import action_logger |
|
|||
32 | from rhodecode.model.db import UserLog, UserFollowing |
|
31 | from rhodecode.model.db import UserLog, UserFollowing | |
33 | from rhodecode.model.scm import ScmModel |
|
32 | from rhodecode.model.scm import ScmModel | |
34 | from sqlalchemy import or_ |
|
33 | from sqlalchemy import or_ | |
@@ -41,6 +40,7 b' class JournalController(BaseController):' | |||||
41 |
|
40 | |||
42 |
|
41 | |||
43 | @LoginRequired() |
|
42 | @LoginRequired() | |
|
43 | @NotAnonymous() | |||
44 | def __before__(self): |
|
44 | def __before__(self): | |
45 | super(JournalController, self).__before__() |
|
45 | super(JournalController, self).__before__() | |
46 |
|
46 | |||
@@ -49,12 +49,12 b' class JournalController(BaseController):' | |||||
49 |
|
49 | |||
50 | c.following = self.sa.query(UserFollowing)\ |
|
50 | c.following = self.sa.query(UserFollowing)\ | |
51 | .filter(UserFollowing.user_id == c.rhodecode_user.user_id).all() |
|
51 | .filter(UserFollowing.user_id == c.rhodecode_user.user_id).all() | |
52 |
|
52 | |||
53 |
repo_ids = [x.follows_repository.repo_id for x in c.following |
|
53 | repo_ids = [x.follows_repository.repo_id for x in c.following | |
54 | if x.follows_repository is not None] |
|
54 | if x.follows_repository is not None] | |
55 |
user_ids = [x.follows_user.user_id for x in c.following |
|
55 | user_ids = [x.follows_user.user_id for x in c.following | |
56 | if x.follows_user is not None] |
|
56 | if x.follows_user is not None] | |
57 |
|
57 | |||
58 | c.journal = self.sa.query(UserLog)\ |
|
58 | c.journal = self.sa.query(UserLog)\ | |
59 | .filter(or_( |
|
59 | .filter(or_( | |
60 | UserLog.repository_id.in_(repo_ids), |
|
60 | UserLog.repository_id.in_(repo_ids), | |
@@ -65,7 +65,6 b' class JournalController(BaseController):' | |||||
65 | .all() |
|
65 | .all() | |
66 | return render('/journal.html') |
|
66 | return render('/journal.html') | |
67 |
|
67 | |||
68 |
|
||||
69 | def toggle_following(self): |
|
68 | def toggle_following(self): | |
70 |
|
69 | |||
71 | if request.POST.get('auth_token') == get_token(): |
|
70 | if request.POST.get('auth_token') == get_token(): |
@@ -170,19 +170,6 b' class ScmModel(BaseModel):' | |||||
170 | 'repository.admin')(repo_name, 'get repo check'): |
|
170 | 'repository.admin')(repo_name, 'get repo check'): | |
171 | return |
|
171 | return | |
172 |
|
172 | |||
173 | pre_invalidate = True |
|
|||
174 | if invalidation_list is not None: |
|
|||
175 | pre_invalidate = repo_name in invalidation_list |
|
|||
176 |
|
||||
177 | if pre_invalidate: |
|
|||
178 | invalidate = self._should_invalidate(repo_name) |
|
|||
179 |
|
||||
180 | if invalidate: |
|
|||
181 | log.info('invalidating cache for repository %s', repo_name) |
|
|||
182 | region_invalidate(_get_repo, None, repo_name) |
|
|||
183 | self._mark_invalidated(invalidate) |
|
|||
184 |
|
||||
185 |
|
||||
186 | #====================================================================== |
|
173 | #====================================================================== | |
187 | # CACHE FUNCTION |
|
174 | # CACHE FUNCTION | |
188 | #====================================================================== |
|
175 | #====================================================================== | |
@@ -224,6 +211,18 b' class ScmModel(BaseModel):' | |||||
224 | repo.dbrepo = dbrepo |
|
211 | repo.dbrepo = dbrepo | |
225 | return repo |
|
212 | return repo | |
226 |
|
213 | |||
|
214 | pre_invalidate = True | |||
|
215 | if invalidation_list is not None: | |||
|
216 | pre_invalidate = repo_name in invalidation_list | |||
|
217 | ||||
|
218 | if pre_invalidate: | |||
|
219 | invalidate = self._should_invalidate(repo_name) | |||
|
220 | ||||
|
221 | if invalidate: | |||
|
222 | log.info('invalidating cache for repository %s', repo_name) | |||
|
223 | region_invalidate(_get_repo, None, repo_name) | |||
|
224 | self._mark_invalidated(invalidate) | |||
|
225 | ||||
227 | return _get_repo(repo_name) |
|
226 | return _get_repo(repo_name) | |
228 |
|
227 | |||
229 |
|
228 |
@@ -22,7 +22,12 b'' | |||||
22 | </div> |
|
22 | </div> | |
23 | <div class="account"> |
|
23 | <div class="account"> | |
24 | %if c.rhodecode_user.username == 'default': |
|
24 | %if c.rhodecode_user.username == 'default': | |
25 | ${h.link_to('anonymous',h.url('register'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))} |
|
25 | %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')(): | |
|
26 | ${h.link_to('anonymous',h.url('register'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))} | |||
|
27 | %else: | |||
|
28 | ${h.link_to('anonymous',h.url('#'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))} | |||
|
29 | %endif | |||
|
30 | ||||
26 | %else: |
|
31 | %else: | |
27 | ${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))} |
|
32 | ${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))} | |
28 | %endif |
|
33 | %endif | |
@@ -31,10 +36,12 b'' | |||||
31 | <li> |
|
36 | <li> | |
32 | <a href="${h.url('home')}">${_('Home')}</a> |
|
37 | <a href="${h.url('home')}">${_('Home')}</a> | |
33 | </li> |
|
38 | </li> | |
|
39 | %if c.rhodecode_user.username != 'default': | |||
34 | <li> |
|
40 | <li> | |
35 | <a href="${h.url('journal')}">${_('Journal')}</a> |
|
41 | <a href="${h.url('journal')}">${_('Journal')}</a> | |
36 | ##(${c.unread_journal})</a> |
|
42 | ##(${c.unread_journal})</a> | |
37 | </li> |
|
43 | </li> | |
|
44 | %endif | |||
38 | %if c.rhodecode_user.username == 'default': |
|
45 | %if c.rhodecode_user.username == 'default': | |
39 | <li class="last highlight">${h.link_to(u'Login',h.url('login_home'))}</li> |
|
46 | <li class="last highlight">${h.link_to(u'Login',h.url('login_home'))}</li> | |
40 | %else: |
|
47 | %else: | |
@@ -257,7 +264,7 b'' | |||||
257 | <span>${_('Home')}</span> |
|
264 | <span>${_('Home')}</span> | |
258 | </a> |
|
265 | </a> | |
259 | </li> |
|
266 | </li> | |
260 |
|
267 | %if c.rhodecode_user.username != 'default': | ||
261 | <li> |
|
268 | <li> | |
262 | <a title="${_('Journal')}" href="${h.url('journal')}"> |
|
269 | <a title="${_('Journal')}" href="${h.url('journal')}"> | |
263 | <span class="icon"> |
|
270 | <span class="icon"> | |
@@ -266,7 +273,7 b'' | |||||
266 | <span>${_('Journal')}</span> |
|
273 | <span>${_('Journal')}</span> | |
267 | </a> |
|
274 | </a> | |
268 | </li> |
|
275 | </li> | |
269 |
|
|
276 | %endif | |
270 | <li> |
|
277 | <li> | |
271 | <a title="${_('Search')}" href="${h.url('search')}"> |
|
278 | <a title="${_('Search')}" href="${h.url('search')}"> | |
272 | <span class="icon"> |
|
279 | <span class="icon"> |
@@ -44,16 +44,17 b'' | |||||
44 | <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="/images/icons/lock_open.png"/> |
|
44 | <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="/images/icons/lock_open.png"/> | |
45 | %endif |
|
45 | %endif | |
46 | <span style="font-size: 1.6em;font-weight: bold;vertical-align: baseline;">${c.repo_info.name}</span> |
|
46 | <span style="font-size: 1.6em;font-weight: bold;vertical-align: baseline;">${c.repo_info.name}</span> | |
47 |
|
47 | %if c.rhodecode_user.username != 'default': | ||
48 | %if c.following: |
|
48 | %if c.following: | |
49 | <span id="follow_toggle" class="following" title="${_('Stop following this repository')}" |
|
49 | <span id="follow_toggle" class="following" title="${_('Stop following this repository')}" | |
50 | onclick="javascript:toggleFollowingRepo(${c.repo_info.dbrepo.repo_id},'${str(h.get_token())}')"> |
|
50 | onclick="javascript:toggleFollowingRepo(${c.repo_info.dbrepo.repo_id},'${str(h.get_token())}')"> | |
51 | </span> |
|
51 | </span> | |
52 | %else: |
|
52 | %else: | |
53 | <span id="follow_toggle" class="follow" title="${_('Start following this repository')}" |
|
53 | <span id="follow_toggle" class="follow" title="${_('Start following this repository')}" | |
54 | onclick="javascript:toggleFollowingRepo(${c.repo_info.dbrepo.repo_id},'${str(h.get_token())}')"> |
|
54 | onclick="javascript:toggleFollowingRepo(${c.repo_info.dbrepo.repo_id},'${str(h.get_token())}')"> | |
55 | </span> |
|
55 | </span> | |
56 | %endif |
|
56 | %endif | |
|
57 | %endif: | |||
57 | <br/> |
|
58 | <br/> | |
58 | %if c.repo_info.dbrepo.fork: |
|
59 | %if c.repo_info.dbrepo.fork: | |
59 | <span style="margin-top:5px"> |
|
60 | <span style="margin-top:5px"> |
General Comments 0
You need to be logged in to leave comments.
Login now