diff --git a/rhodecode/apps/my_account/views/my_account.py b/rhodecode/apps/my_account/views/my_account.py --- a/rhodecode/apps/my_account/views/my_account.py +++ b/rhodecode/apps/my_account/views/my_account.py @@ -723,12 +723,12 @@ class MyAccountView(BaseAppView, DataGri pull_requests = PullRequestModel().get_im_participating_in( user_id=self._rhodecode_user.user_id, - statuses=statuses, + statuses=statuses, query=search_q, offset=start, length=limit, order_by=order_by, order_dir=order_dir) pull_requests_total_count = PullRequestModel().count_im_participating_in( - user_id=self._rhodecode_user.user_id, statuses=statuses) + user_id=self._rhodecode_user.user_id, statuses=statuses, query=search_q) data = [] comments_model = CommentsModel() diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -355,7 +355,7 @@ class PullRequestModel(BaseModel): PullRequestReviewers.user_id == user_id).all() ] - def _prepare_participating_query(self, user_id=None, statuses=None, + def _prepare_participating_query(self, user_id=None, statuses=None, query='', order_by=None, order_dir='desc'): q = PullRequest.query() if user_id: @@ -372,6 +372,13 @@ class PullRequestModel(BaseModel): if statuses: q = q.filter(PullRequest.status.in_(statuses)) + if query: + like_expression = u'%{}%'.format(safe_unicode(query)) + q = q.filter(or_( + cast(PullRequest.pull_request_id, String).ilike(like_expression), + PullRequest.title.ilike(like_expression), + PullRequest.description.ilike(like_expression), + )) if order_by: order_map = { 'name_raw': PullRequest.pull_request_id, @@ -386,19 +393,19 @@ class PullRequestModel(BaseModel): return q - def count_im_participating_in(self, user_id=None, statuses=None): - q = self._prepare_participating_query(user_id, statuses=statuses) + def count_im_participating_in(self, user_id=None, statuses=None, query=''): + q = self._prepare_participating_query(user_id, statuses=statuses, query=query) return q.count() def get_im_participating_in( - self, user_id=None, statuses=None, offset=0, + self, user_id=None, statuses=None, query='', offset=0, length=None, order_by=None, order_dir='desc'): """ Get all Pull requests that i'm participating in, or i have opened """ q = self._prepare_participating_query( - user_id, statuses=statuses, order_by=order_by, + user_id, statuses=statuses, query=query, order_by=order_by, order_dir=order_dir) if length: diff --git a/rhodecode/templates/admin/my_account/my_account_pullrequests.mako b/rhodecode/templates/admin/my_account/my_account_pullrequests.mako --- a/rhodecode/templates/admin/my_account/my_account_pullrequests.mako +++ b/rhodecode/templates/admin/my_account/my_account_pullrequests.mako @@ -2,11 +2,29 @@