Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
fix state check on InlineTargetCellEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed May 4, 2012
1 parent a26273c commit 8afa6fc
Showing 1 changed file with 11 additions and 9 deletions.
Expand Up @@ -261,7 +261,7 @@ public void acceptFuzzyEdit()
curCallback.onComplete(curCellEditInfo, cellValue);
}

private void determineStatus(ArrayList<String> newTargets, ContentState stateToSet)
private void determineStatus(ArrayList<String> newTargets, ContentState requestedState)
{
Collection<String> emptyTargets = Collections2.filter(newTargets, new Predicate<String>()
{
Expand All @@ -271,18 +271,20 @@ public boolean apply(@Nullable String input)
return Strings.isNullOrEmpty(input);
}
});
if (emptyTargets.isEmpty() && stateToSet == ContentState.Approved)
{
cellValue.setStatus(ContentState.Approved);
}
else if (emptyTargets.size() > 0 && stateToSet == ContentState.NeedReview)

ContentState stateToSet = requestedState;

if (requestedState == ContentState.New && emptyTargets.isEmpty())
{
cellValue.setStatus(ContentState.NeedReview);
stateToSet = ContentState.NeedReview;
}
else

if (requestedState == ContentState.Approved && !emptyTargets.isEmpty())
{
cellValue.setStatus(ContentState.New);
stateToSet = ContentState.New;
}

cellValue.setStatus(stateToSet);
}

/**
Expand Down

0 comments on commit 8afa6fc

Please sign in to comment.