Source:
<code>public UiAction.Description getDescription(RevisionResource resource) { PatchSet.Id current = resource.getChange().currentPatchSetId(); String topic = resource.getChange().getTopic(); boolean visible = !resource.getPatchSet().isDraft() && resource.getChange().getStatus().isOpen() && resource.getPatchSet().getId().equals(current) && resource.getControl().canSubmit(); ReviewDb db = dbProvider.get(); ChangeData cd = changeDataFactory.create(db, resource.getControl()); <START> if (areChangesSubmittable(Arrays.asList(cd), resource.getUser()) != null) <END> visible = false; if (!visible) { return new UiAction.Description() .setLabel("") .setTitle("") .setVisible(false); } if (submitWholeTopic && !Strings.isNullOrEmpty(topic)) { List<ChangeData> changesByTopic = null; try { changesByTopic = queryProvider.get().byTopicOpen(topic); } catch (OrmException e) { throw new OrmRuntimeException(e); } Map<String, String> params = ImmutableMap.of( "topicSize", String.valueOf(changesByTopic.size())); String topicProblems = areChangesSubmittable(changesByTopic, resource.getUser()); if (!Strings.isNullOrEmpty(topicProblems)) { return new UiAction.Description() .setLabel(submitTopicLabel) .setTitle(topicProblems) .setVisible(true) .setEnabled(false); } else { return new UiAction.Description() .setLabel(submitTopicLabel) .setTitle(Strings.emptyToNull( submitTopicTooltip.replace(params))) .setVisible(true) .setEnabled(true); } } else { RevId revId = resource.getPatchSet().getRevision(); Map<String, String> params = ImmutableMap.of( "patchSet", String.valueOf(resource.getPatchSet().getPatchSetId()), "branch", resource.getChange().getDest().getShortName(), "commit", ObjectId.fromString(revId.get()).abbreviate(7).name()); return new UiAction.Description() .setLabel(label) .setTitle(Strings.emptyToNull(titlePattern.replace(params))) .setVisible(true); } }</code><technical_language>{} blocks</technical_language>

Target:
public UiAction.Description getDescription(RevisionResource resource) { PatchSet.Id current = resource.getChange().currentPatchSetId(); String topic = resource.getChange().getTopic(); boolean visible = !resource.getPatchSet().isDraft() && resource.getChange().getStatus().isOpen() && resource.getPatchSet().getId().equals(current) && resource.getControl().canSubmit(); ReviewDb db = dbProvider.get(); ChangeData cd = changeDataFactory.create(db, resource.getControl()); if (areChangesSubmittable(Arrays.asList(cd), resource.getUser()) != null) { visible = false; } if (!visible) { return new UiAction.Description() .setLabel("") .setTitle("") .setVisible(false); } if (submitWholeTopic && !Strings.isNullOrEmpty(topic)) { List<ChangeData> changesByTopic = null; try { changesByTopic = queryProvider.get().byTopicOpen(topic); } catch (OrmException e) { throw new OrmRuntimeException(e); } Map<String, String> params = ImmutableMap.of( "topicSize", String.valueOf(changesByTopic.size())); String topicProblems = areChangesSubmittable(changesByTopic, resource.getUser()); if (!Strings.isNullOrEmpty(topicProblems)) { return new UiAction.Description() .setLabel(submitTopicLabel) .setTitle(topicProblems) .setVisible(true) .setEnabled(false); } else { return new UiAction.Description() .setLabel(submitTopicLabel) .setTitle(Strings.emptyToNull( submitTopicTooltip.replace(params))) .setVisible(true) .setEnabled(true); } } else { RevId revId = resource.getPatchSet().getRevision(); Map<String, String> params = ImmutableMap.of( "patchSet", String.valueOf(resource.getPatchSet().getPatchSetId()), "branch", resource.getChange().getDest().getShortName(), "commit", ObjectId.fromString(revId.get()).abbreviate(7).name()); return new UiAction.Description() .setLabel(label) .setTitle(Strings.emptyToNull(titlePattern.replace(params))) .setVisible(true); } }