##// END OF EJS Templates
Optimized queries on journal, and added quick stop following action button in journal
marcink -
r1000:22943721 beta
parent child Browse files
Show More
@@ -39,6 +39,7 b' from rhodecode.model.db import UserLog, '
39 from rhodecode.model.scm import ScmModel
39 from rhodecode.model.scm import ScmModel
40
40
41 from paste.httpexceptions import HTTPInternalServerError
41 from paste.httpexceptions import HTTPInternalServerError
42 from sqlalchemy.orm import joinedload
42
43
43 log = logging.getLogger(__name__)
44 log = logging.getLogger(__name__)
44
45
@@ -54,7 +55,9 b' class JournalController(BaseController):'
54 # Return a rendered template
55 # Return a rendered template
55
56
56 c.following = self.sa.query(UserFollowing)\
57 c.following = self.sa.query(UserFollowing)\
57 .filter(UserFollowing.user_id == c.rhodecode_user.user_id).all()
58 .filter(UserFollowing.user_id == c.rhodecode_user.user_id)\
59 .options(joinedload(UserFollowing.follows_repository))\
60 .all()
58
61
59 repo_ids = [x.follows_repository.repo_id for x in c.following
62 repo_ids = [x.follows_repository.repo_id for x in c.following
60 if x.follows_repository is not None]
63 if x.follows_repository is not None]
@@ -313,7 +313,7 b' class UserFollowing(Base, BaseModel):'
313 user = relationship('User', primaryjoin='User.user_id==UserFollowing.user_id')
313 user = relationship('User', primaryjoin='User.user_id==UserFollowing.user_id')
314
314
315 follows_user = relationship('User', primaryjoin='User.user_id==UserFollowing.follows_user_id')
315 follows_user = relationship('User', primaryjoin='User.user_id==UserFollowing.follows_user_id')
316 follows_repository = relationship('Repository')
316 follows_repository = relationship('Repository', order_by='Repository.repo_name')
317
317
318 class CacheInvalidation(Base, BaseModel):
318 class CacheInvalidation(Base, BaseModel):
319 __tablename__ = 'cache_invalidation'
319 __tablename__ = 'cache_invalidation'
@@ -43,7 +43,12 b''
43 %endif
43 %endif
44
44
45 %if entry.follows_repo_id:
45 %if entry.follows_repo_id:
46
46
47 <div style="float:left;padding-right:5px">
48 <span id="follow_toggle_${entry.follows_repository.repo_id}" class="following" title="${_('Stop following this repository')}"
49 onclick="javascript:toggleFollowingRepo(this,${entry.follows_repository.repo_id},'${str(h.get_token())}')">
50 </span>
51 </div>
47 %if entry.follows_repository.private:
52 %if entry.follows_repository.private:
48 <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="/images/icons/lock.png"/>
53 <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="/images/icons/lock.png"/>
49 %else:
54 %else:
General Comments 0
You need to be logged in to leave comments. Login now