Fix side-by-side / unified navigation links
Now that toSideBySide() explicitly redirects to SideBySide, use toPatch() instead when appropriate. Change-Id: Id8839c2b66f5ea39f7998ea8230e8ca0c5613d8f
This commit is contained in:
		@@ -107,8 +107,18 @@ import com.google.gwtexpui.user.client.UserAgent;
 | 
			
		||||
import com.google.gwtorm.client.KeyUtil;
 | 
			
		||||
 | 
			
		||||
public class Dispatcher {
 | 
			
		||||
  public static String toPatch(PatchSet.Id diffBase,
 | 
			
		||||
      PatchSet.Id revision, String fileName) {
 | 
			
		||||
    return toPatch("", diffBase, revision, fileName, null, 0);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public static String toPatch(PatchSet.Id diffBase,
 | 
			
		||||
      PatchSet.Id revision, String fileName, DisplaySide side, int line) {
 | 
			
		||||
    return toPatch("", diffBase, revision, fileName, side, line);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public static String toSideBySide(PatchSet.Id diffBase, Patch.Key id) {
 | 
			
		||||
    return toPatch("", diffBase, id);
 | 
			
		||||
    return toPatch("sidebyside", diffBase, id);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public static String toSideBySide(PatchSet.Id diffBase,
 | 
			
		||||
@@ -116,11 +126,6 @@ public class Dispatcher {
 | 
			
		||||
    return toPatch("sidebyside", diffBase, revision, fileName, null, 0);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public static String toSideBySide(PatchSet.Id diffBase,
 | 
			
		||||
      PatchSet.Id revision, String fileName, DisplaySide side, int line) {
 | 
			
		||||
    return toPatch("sidebyside", diffBase, revision, fileName, side, line);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public static String toUnified(PatchSet.Id diffBase,
 | 
			
		||||
      PatchSet.Id revision, String fileName) {
 | 
			
		||||
    return toPatch("unified", diffBase, revision, fileName, null, 0);
 | 
			
		||||
@@ -472,7 +477,7 @@ public class Dispatcher {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ("".equals(panel) || /* DEPRECATED URL */"cm".equals(panel)) {
 | 
			
		||||
      if (preferUnified() || (UserAgent.isPortrait() && UserAgent.isMobile())) {
 | 
			
		||||
      if (preferUnified()) {
 | 
			
		||||
        unified(token, baseId, id, side, line);
 | 
			
		||||
      } else {
 | 
			
		||||
        codemirror(token, baseId, id, side, line, false);
 | 
			
		||||
@@ -491,7 +496,8 @@ public class Dispatcher {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private static boolean preferUnified() {
 | 
			
		||||
    return DiffView.UNIFIED_DIFF.equals(Gerrit.getUserPreferences().diffView());
 | 
			
		||||
    return DiffView.UNIFIED_DIFF.equals(Gerrit.getUserPreferences().diffView())
 | 
			
		||||
        || (UserAgent.isPortrait() && UserAgent.isMobile());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private static void unified(final String token, final PatchSet.Id baseId,
 | 
			
		||||
 
 | 
			
		||||
@@ -49,6 +49,6 @@ class FileComments extends Composite {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private static String url(PatchSet.Id ps, CommentInfo info) {
 | 
			
		||||
    return Dispatcher.toSideBySide(null, ps, info.path());
 | 
			
		||||
    return Dispatcher.toPatch(null, ps, info.path());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -284,7 +284,7 @@ public class FileTable extends FlowPanel {
 | 
			
		||||
    return info.binary()
 | 
			
		||||
      ? Dispatcher.toUnified(base, curr, info.path())
 | 
			
		||||
      : mode == Mode.REVIEW
 | 
			
		||||
            ? Dispatcher.toSideBySide(base, curr, info.path())
 | 
			
		||||
            ? Dispatcher.toPatch(base, curr, info.path())
 | 
			
		||||
            : Dispatcher.toEditScreen(curr, info.path());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@ class LineComment extends Composite {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private static String url(PatchSet.Id ps, CommentInfo info) {
 | 
			
		||||
    return Dispatcher.toSideBySide(null, ps, info.path(),
 | 
			
		||||
    return Dispatcher.toPatch(null, ps, info.path(),
 | 
			
		||||
        info.side() == Side.PARENT ? DisplaySide.A : DisplaySide.B,
 | 
			
		||||
        info.line());
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user