Make "My Drafts" limited to own drafts
The query "is:draft" also returns other users' drafts if the current user has the "View Drafts" capability. Limit it to the user's own changes by adding the "owner:self" clause. Change-Id: Ib144e447687ae1d6fd99d34e108abb8a2f79e606
This commit is contained in:
		@@ -909,7 +909,7 @@ link:#preferences-info[PreferencesInfo] entity.
 | 
			
		||||
        "name": "Changes"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "url": "#/q/is:draft",
 | 
			
		||||
        "url": "#/q/owner:self+is:draft",
 | 
			
		||||
        "name": "Drafts"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
@@ -963,7 +963,7 @@ link:#preferences-input[PreferencesInput] entity.
 | 
			
		||||
        "name": "Changes"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "url": "#/q/is:draft",
 | 
			
		||||
        "url": "#/q/owner:self+is:draft",
 | 
			
		||||
        "name": "Drafts"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
@@ -1011,7 +1011,7 @@ link:#preferences-info[PreferencesInfo] entity.
 | 
			
		||||
        "name": "Changes"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "url": "#/q/is:draft",
 | 
			
		||||
        "url": "#/q/owner:self+is:draft",
 | 
			
		||||
        "name": "Drafts"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ matches the search, the change will be presented instead of a list.
 | 
			
		||||
|All > Open           | status:open '(or is:open)'
 | 
			
		||||
|All > Merged         | status:merged
 | 
			
		||||
|All > Abandoned      | status:abandoned
 | 
			
		||||
|My > Drafts          | is:draft
 | 
			
		||||
|My > Drafts          | owner:self is:draft
 | 
			
		||||
|My > Watched Changes | status:open is:watched
 | 
			
		||||
|My > Starred Changes | is:starred
 | 
			
		||||
|My > Draft Comments  | has:draft
 | 
			
		||||
 
 | 
			
		||||
@@ -284,7 +284,7 @@ public class Dispatcher {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (matchExact("mine,drafts", token)) {
 | 
			
		||||
      return toChangeQuery("is:draft");
 | 
			
		||||
      return toChangeQuery("owner:self is:draft");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (matchExact("mine,comments", token)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@ public class JumpKeys {
 | 
			
		||||
      jumps.add(new KeyCommand(0, 'd', Gerrit.C.jumpMineDrafts()) {
 | 
			
		||||
        @Override
 | 
			
		||||
        public void onKeyPress(final KeyPressEvent event) {
 | 
			
		||||
          Gerrit.display(PageLinks.toChangeQuery("is:draft"));
 | 
			
		||||
          Gerrit.display(PageLinks.toChangeQuery("owner:self is:draft"));
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
      jumps.add(new KeyCommand(0, 'c', Gerrit.C.jumpMineDraftComments()) {
 | 
			
		||||
 
 | 
			
		||||
@@ -147,7 +147,7 @@ public class GetPreferences implements RestReadView<AccountResource> {
 | 
			
		||||
      }
 | 
			
		||||
      if (my.isEmpty()) {
 | 
			
		||||
        my.add(new TopMenu.MenuItem("Changes", "#/dashboard/self", null));
 | 
			
		||||
        my.add(new TopMenu.MenuItem("Drafts", "#/q/is:draft", null));
 | 
			
		||||
        my.add(new TopMenu.MenuItem("Drafts", "#/q/owner:self+is:draft", null));
 | 
			
		||||
        my.add(new TopMenu.MenuItem("Draft Comments", "#/q/has:draft", null));
 | 
			
		||||
        my.add(new TopMenu.MenuItem("Watched Changes", "#/q/is:watched+is:open", null));
 | 
			
		||||
        my.add(new TopMenu.MenuItem("Starred Changes", "#/q/is:starred", null));
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user