diff --git a/kallithea/controllers/admin/notifications.py b/kallithea/controllers/admin/notifications.py --- a/kallithea/controllers/admin/notifications.py +++ b/kallithea/controllers/admin/notifications.py @@ -93,7 +93,7 @@ class NotificationsController(BaseContro def update(self, notification_id): try: no = Notification.get(notification_id) - owner = all(un.user.user_id == c.authuser.user_id + owner = all(un.user_id == c.authuser.user_id for un in no.notifications_to_users) if h.HasPermissionAny('hg.admin')() or owner: # deletes only notification2user @@ -108,7 +108,7 @@ class NotificationsController(BaseContro def delete(self, notification_id): try: no = Notification.get(notification_id) - owner = any(un.user.user_id == c.authuser.user_id + owner = any(un.user_id == c.authuser.user_id for un in no.notifications_to_users) if h.HasPermissionAny('hg.admin')() or owner: # deletes only notification2user diff --git a/kallithea/controllers/admin/repos.py b/kallithea/controllers/admin/repos.py --- a/kallithea/controllers/admin/repos.py +++ b/kallithea/controllers/admin/repos.py @@ -423,7 +423,7 @@ class ReposController(BaseRepoController if x.repo_id != c.repo_info.repo_id] defaults = { - 'id_fork_of': c.repo_info.fork.repo_id if c.repo_info.fork else '' + 'id_fork_of': c.repo_info.fork_id if c.repo_info.fork_id else '' } c.active = 'advanced' diff --git a/kallithea/controllers/changeset.py b/kallithea/controllers/changeset.py --- a/kallithea/controllers/changeset.py +++ b/kallithea/controllers/changeset.py @@ -422,7 +422,7 @@ class ChangesetController(BaseRepoContro co = ChangesetComment.get_or_404(comment_id) if co.repo.repo_name != repo_name: raise HTTPNotFound() - owner = co.author.user_id == c.authuser.user_id + owner = co.author_id == c.authuser.user_id repo_admin = h.HasRepoPermissionAny('repository.admin')(repo_name) if h.HasPermissionAny('hg.admin')() or repo_admin or owner: ChangesetCommentsModel().delete(comment=co) diff --git a/kallithea/controllers/journal.py b/kallithea/controllers/journal.py --- a/kallithea/controllers/journal.py +++ b/kallithea/controllers/journal.py @@ -78,10 +78,10 @@ class JournalController(BaseController): return groups def _get_journal_data(self, following_repos): - repo_ids = [x.follows_repository.repo_id for x in following_repos - if x.follows_repository is not None] - user_ids = [x.follows_user.user_id for x in following_repos - if x.follows_user is not None] + repo_ids = [x.follows_repo_id for x in following_repos + if x.follows_repo_id is not None] + user_ids = [x.follows_user_id for x in following_repos + if x.follows_user_id is not None] filtering_criterion = None diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py +++ b/kallithea/controllers/pullrequests.py @@ -473,7 +473,7 @@ class PullrequestsController(BaseRepoCon ChangesetCommentsModel().create( text=_('Closed, next iteration: %s .') % pull_request.url(canonical=True), - repo=old_pull_request.other_repo.repo_id, + repo=old_pull_request.other_repo_id, author=c.authuser.user_id, pull_request=old_pull_request.pull_request_id, closing_pr=True) @@ -536,7 +536,7 @@ class PullrequestsController(BaseRepoCon def delete(self, repo_name, pull_request_id): pull_request = PullRequest.get_or_404(pull_request_id) #only owner can delete it ! - if pull_request.owner.user_id == c.authuser.user_id: + if pull_request.owner_id == c.authuser.user_id: PullRequestModel().delete(pull_request) Session().commit() h.flash(_('Successfully deleted pull request'), @@ -758,7 +758,7 @@ class PullrequestsController(BaseRepoCon raise HTTPForbidden() if delete == "delete": - if (pull_request.owner.user_id == c.authuser.user_id or + if (pull_request.owner_id == c.authuser.user_id or h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(pull_request.org_repo.repo_name) or h.HasRepoPermissionAny('repository.admin')(pull_request.other_repo.repo_name) @@ -830,7 +830,7 @@ class PullrequestsController(BaseRepoCon #don't allow deleting comments on closed pull request raise HTTPForbidden() - owner = co.author.user_id == c.authuser.user_id + owner = co.author_id == c.authuser.user_id repo_admin = h.HasRepoPermissionAny('repository.admin')(c.repo_name) if h.HasPermissionAny('hg.admin')() or repo_admin or owner: ChangesetCommentsModel().delete(comment=co) diff --git a/kallithea/model/user_group.py b/kallithea/model/user_group.py --- a/kallithea/model/user_group.py +++ b/kallithea/model/user_group.py @@ -202,7 +202,7 @@ class UserGroupModel(BaseModel): user_group_member = None for m in user_group.members: - if m.user.user_id == user.user_id: + if m.user_id == user.user_id: # Found this user's membership row user_group_member = m break diff --git a/kallithea/templates/changeset/changeset_file_comment.html b/kallithea/templates/changeset/changeset_file_comment.html --- a/kallithea/templates/changeset/changeset_file_comment.html +++ b/kallithea/templates/changeset/changeset_file_comment.html @@ -24,7 +24,7 @@ - %if co.author.user_id == c.authuser.user_id or h.HasRepoPermissionAny('repository.admin')(c.repo_name): + %if co.author_id == c.authuser.user_id or h.HasRepoPermissionAny('repository.admin')(c.repo_name): %if co.deletable():
${_('Delete')}
%endif @@ -81,7 +81,7 @@ %if c.pull_request is not None and ( \ h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) \ - or c.pull_request.owner.user_id == c.authuser.user_id): + or c.pull_request.owner_id == c.authuser.user_id):
${_('Finish pull request')}: