Skip to content

Commit

Permalink
CLDR-16835 ddl phase - back end changes for separate ddl phase
Browse files Browse the repository at this point in the history
- back end changes supporting a separate ddl phase
  • Loading branch information
srl295 committed Jun 11, 2024
1 parent c9f8908 commit 86af6e4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,7 @@ public Map<String, String> getNonDistinguishingAttributes() {
*/
public StatusAction getStatusAction(InputMethod inputMethod) {
// null because this is for display.
return SurveyMain.phase()
.getCPhase()
return SurveyMain.getCPhase(locale)
.getShowRowAction(this, inputMethod, getPathHeader(), userForVotelist);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2658,7 +2658,7 @@ public static void handleBulkSubmit(
final List<CheckCLDR.CheckStatus> checkResult = new ArrayList<>();
TestCache.TestResultBundle cc = stf.getTestResult(loc, DataPage.getOptions(cs, loc));
UserRegistry.User u = theirU;
CheckCLDR.Phase cPhase = CLDRConfig.getInstance().getPhase();
CheckCLDR.Phase cPhase = SurveyMain.getCPhase(loc);
Set<String> allValidPaths = stf.getPathsForFile(loc);
CLDRProgressTask progress = sm.openProgress("Bulk:" + loc, all.size());
CLDRFile cldrUnresolved = cf.getUnresolved();
Expand Down
28 changes: 22 additions & 6 deletions tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import org.unicode.cldr.test.CheckCLDR;
import org.unicode.cldr.test.ExampleGenerator;
import org.unicode.cldr.test.HelpMessages;
import org.unicode.cldr.test.SubmissionLocales;
import org.unicode.cldr.util.CLDRCacheDir;
import org.unicode.cldr.util.CLDRConfig;
import org.unicode.cldr.util.CLDRConfigImpl;
Expand Down Expand Up @@ -2078,9 +2079,9 @@ public String getLocaleLink(WebContext ctx, CLDRLocale locale, String n) {
if (canModify) {
rv = rv + (modifyThing(ctx));
int odisp;
if ((SurveyMain.phase() == Phase.VETTING
|| SurveyMain.phase() == Phase.SUBMIT
|| isPhaseVettingClosed())
if ((SurveyMain.phase(locale) == Phase.VETTING
|| SurveyMain.phase(locale) == Phase.SUBMIT
|| isPhaseVettingClosed(locale))
&& ((odisp = DisputePageManager.getOrgDisputeCount(ctx)) > 0)) {
rv = rv + ctx.iconHtml("disp", "(" + odisp + " org disputes)");
}
Expand Down Expand Up @@ -2827,7 +2828,11 @@ private void doStartup() {
String ddlPhaseString = survprops.getProperty("CLDR_DDL_PHASE", null);
Phase ddlPhase = null;
try {
if (ddlPhaseString != null) {
if (ddlPhaseString != null && !ddlPhaseString.isEmpty()) {
if (currentPhase == Phase.READONLY) {
busted(
"Error: Cannot have a CLDR_DDL_PHASE when CLDR_PHASE=READONLY. Remove the CLDR_DDL_PHASE.");
}
ddlPhase = (Phase.valueOf(ddlPhaseString));
}
} catch (IllegalArgumentException iae) {
Expand Down Expand Up @@ -3569,8 +3574,8 @@ public static String localhost() {

// ============= Following have to do with phases

public static boolean isPhaseVettingClosed() {
return phase() == Phase.VETTING_CLOSED;
public static boolean isPhaseVettingClosed(CLDRLocale locale) {
return phase(locale) == Phase.VETTING_CLOSED;
}

public static boolean isPhaseReadonly() {
Expand All @@ -3585,6 +3590,17 @@ public static Phase phase() {
return currentPhase;
}

public static Phase phase(CLDRLocale locale) {
return (SubmissionLocales.isTcLocale(locale) ? phase() : getDDLPhase());
}

/**
* @returns the current phase for the locale. This is the preferred API.
*/
public static CheckCLDR.Phase getCPhase(CLDRLocale loc) {
return phase(loc).getCPhase();
}

public static Phase getDDLPhase() {
return currentDdlPhase;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,7 @@ public static ModifyDenial userCanModifyLocaleWhy(User u, CLDRLocale locale) {
if (userIsAdmin(u) || userIsTC(u)) return null;

// Otherwise, if closed, deny
if (SurveyMain.isPhaseVettingClosed()) return ModifyDenial.DENY_PHASE_CLOSED;
if (SurveyMain.isPhaseVettingClosed(locale)) return ModifyDenial.DENY_PHASE_CLOSED;
if (SurveyMain.isPhaseReadonly()) return ModifyDenial.DENY_PHASE_READONLY;

return null;
Expand Down

0 comments on commit 86af6e4

Please sign in to comment.