Merge branch 'stable-2.6' into stable-2.7
* stable-2.6: Use user's full name even when email is not configured Only handle last value change event for attached change screens Update the 2.6 release notes Fixed: Draft patch sets are visible in diff screens Conflicts: gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java Change-Id: I81caac73d26869f7be875118cc1e312a54e43a07
This commit is contained in:
@@ -1192,7 +1192,7 @@ but was coming up black on initial page load due to a style setup
|
||||
ordering issue between the SearchPanel and the HintTextBox.
|
||||
|
||||
* link:https://code.google.com/p/gerrit/issues/detail?id=1661[Issue 1661]:
|
||||
Update links to Change-Id and Signed-off-by docu on project info
|
||||
Update links to Change-Id and Signed-off-by documentation on project info
|
||||
screen
|
||||
|
||||
* Use href="javascript;" for All {Side-by-Side,Unified} links
|
||||
@@ -1232,6 +1232,9 @@ Correctly handle paths with URL-escaped characters
|
||||
URL-unescape the path portion of a change history token to correctly
|
||||
handle paths with URL-escapable characters, i.e. '+', ' ', etc.
|
||||
|
||||
* link:https://code.google.com/p/gerrit/issues/detail?id=1915[Issue 1915]:
|
||||
Don't show non-visible drafts in the diff screens.
|
||||
|
||||
|
||||
REST API
|
||||
~~~~~~~~
|
||||
|
@@ -88,6 +88,7 @@ public class ChangeScreen extends Screen
|
||||
private KeyCommandSet keysAction;
|
||||
private HandlerRegistration regNavigation;
|
||||
private HandlerRegistration regAction;
|
||||
private HandlerRegistration regDetailCache;
|
||||
|
||||
private Grid patchesGrid;
|
||||
private ListBox patchesList;
|
||||
@@ -132,6 +133,10 @@ public class ChangeScreen extends Screen
|
||||
regAction.removeHandler();
|
||||
regAction = null;
|
||||
}
|
||||
if (regDetailCache != null) {
|
||||
regDetailCache.removeHandler();
|
||||
regDetailCache = null;
|
||||
}
|
||||
super.onUnload();
|
||||
}
|
||||
|
||||
@@ -152,7 +157,7 @@ public class ChangeScreen extends Screen
|
||||
ChangeCache cache = ChangeCache.get(changeId);
|
||||
|
||||
detailCache = cache.getChangeDetailCache();
|
||||
detailCache.addValueChangeHandler(this);
|
||||
regDetailCache = detailCache.addValueChangeHandler(this);
|
||||
|
||||
addStyleName(Gerrit.RESOURCES.css().changeScreen());
|
||||
addStyleName(Gerrit.RESOURCES.css().screenNoHeader());
|
||||
@@ -263,7 +268,7 @@ public class ChangeScreen extends Screen
|
||||
|
||||
@Override
|
||||
public void onValueChange(final ValueChangeEvent<ChangeDetail> event) {
|
||||
if (isAttached()) {
|
||||
if (isAttached() && isLastValueChangeHandler()) {
|
||||
// Until this screen is fully migrated to the new API, these calls must
|
||||
// happen sequentially after the ChangeDetail lookup, because we can't
|
||||
// start an async get at the source of every call that might trigger a
|
||||
@@ -295,6 +300,15 @@ public class ChangeScreen extends Screen
|
||||
}
|
||||
}
|
||||
|
||||
// Find the last attached screen.
|
||||
// When DialogBox is used (i. e. CommentedActionDialog) then the original
|
||||
// ChangeScreen is still in attached state.
|
||||
// Use here the fact, that the handlers (ChangeScreen) are sorted.
|
||||
private boolean isLastValueChangeHandler() {
|
||||
int count = detailCache.getHandlerCount();
|
||||
return count > 0 && detailCache.getHandler(count - 1) == this;
|
||||
}
|
||||
|
||||
private void display(final ChangeDetail detail) {
|
||||
displayTitle(detail.getChange().getKey(), detail.getChange().getSubject());
|
||||
discardDiffBaseIfNotApplicable(detail.getChange().getId());
|
||||
|
@@ -45,4 +45,13 @@ public class ListenableValue<T> implements HasValueChangeHandlers<T> {
|
||||
ValueChangeHandler<T> handler) {
|
||||
return manager.addHandler(ValueChangeEvent.getType(), handler);
|
||||
}
|
||||
|
||||
public int getHandlerCount() {
|
||||
return manager.getHandlerCount(ValueChangeEvent.getType());
|
||||
}
|
||||
|
||||
public ValueChangeHandler<?> getHandler(int index) {
|
||||
return manager.getHandler(ValueChangeEvent.getType(), index);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -138,6 +138,11 @@ class PatchScriptFactory extends Handler<PatchScript> {
|
||||
aId = psa != null ? toObjectId(db, psa) : null;
|
||||
bId = toObjectId(db, psb);
|
||||
|
||||
if ((psa != null && !control.isPatchVisible(db.patchSets().get(psa), db)) ||
|
||||
(psb != null && !control.isPatchVisible(db.patchSets().get(psb), db))) {
|
||||
throw new NoSuchChangeException(changeId);
|
||||
}
|
||||
|
||||
final Repository git;
|
||||
try {
|
||||
git = repoManager.openRepository(projectKey);
|
||||
@@ -232,6 +237,9 @@ class PatchScriptFactory extends Handler<PatchScript> {
|
||||
// proper rename detection between the patch sets.
|
||||
//
|
||||
for (final PatchSet ps : db.patchSets().byChange(changeId)) {
|
||||
if (!control.isPatchVisible(ps, db)) {
|
||||
continue;
|
||||
}
|
||||
String name = patchKey.get();
|
||||
if (psa != null) {
|
||||
switch (changeType) {
|
||||
|
@@ -98,10 +98,11 @@ public class FromAddressGeneratorProvider implements
|
||||
@Override
|
||||
public Address from(final Account.Id fromId) {
|
||||
if (fromId != null) {
|
||||
final Account a = accountCache.get(fromId).getAccount();
|
||||
if (a.getPreferredEmail() != null) {
|
||||
return new Address(a.getFullName(), a.getPreferredEmail());
|
||||
}
|
||||
Account a = accountCache.get(fromId).getAccount();
|
||||
String userEmail = a.getPreferredEmail();
|
||||
return new Address(
|
||||
a.getFullName(),
|
||||
userEmail != null ? userEmail : srvAddr.getEmail());
|
||||
}
|
||||
return srvAddr;
|
||||
}
|
||||
|
@@ -102,12 +102,13 @@ public class FromAddressGeneratorProviderTest extends TestCase {
|
||||
public void testUSER_NoPreferredEmailUser() {
|
||||
setFrom("USER");
|
||||
|
||||
final Account.Id user = user("A U. Thor", null);
|
||||
final String name = "A U. Thor";
|
||||
final Account.Id user = user(name, null);
|
||||
|
||||
replay(accountCache);
|
||||
final Address r = create().from(user);
|
||||
assertNotNull(r);
|
||||
assertEquals(ident.getName(), r.name);
|
||||
assertEquals(name, r.name);
|
||||
assertEquals(ident.getEmailAddress(), r.email);
|
||||
verify(accountCache);
|
||||
}
|
||||
|
Reference in New Issue
Block a user