Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLDR-16799 allow not-logged-in to see dashboard #3843

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions tools/cldr-apps/js/src/views/DashboardWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,6 @@ export default {
},

fetchData() {
if (!cldrStatus.getSurveyUser()) {
this.fetchErr = "Please log in to see the Dashboard.";
return;
}
this.locale = cldrStatus.getCurrentLocale();
this.level = cldrCoverage.effectiveName(this.locale);
if (!this.locale || !this.level) {
Expand Down
15 changes: 13 additions & 2 deletions tools/cldr-apps/src/main/java/org/unicode/cldr/web/Dashboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,22 @@ public ReviewEntry(String code) {
public ReviewOutput get(
CLDRLocale locale, UserRegistry.User user, Level coverageLevel, String xpath) {
final SurveyMain sm = CookieSession.sm;
Organization usersOrg = Organization.fromString(user.voterOrg());
Organization usersOrg = Organization.unaffiliated;
if (user != null) {
usersOrg = Organization.fromString(user.voterOrg());
}
STFactory sourceFactory = sm.getSTFactory();
VettingViewer<Organization> vv =
new VettingViewer<>(
sm.getSupplementalDataInfo(), sourceFactory, new STUsersChoice(sm));
EnumSet<NotificationCategory> choiceSet =
VettingViewer.getDashboardNotificationCategories(usersOrg);
VettingParameters args = new VettingParameters(choiceSet, locale, coverageLevel);
args.setUserAndOrganization(user.id, usersOrg);
if (user != null) {
args.setUserAndOrganization(user.id, usersOrg);
} else {
args.setUserAndOrganization(UserRegistry.NO_USER, usersOrg);
}
args.setFiles(locale, sourceFactory, sm.getDiskFactory());
if (xpath != null) {
args.setXpath(xpath);
Expand Down Expand Up @@ -286,6 +293,10 @@ private void addNotificationEntries(

notification = getNextNotification(reviewOutput, notification, entry);

if (notification.category.equals("Abstained")
&& args.getUserId() == UserRegistry.NO_USER) {
continue; // don't show abstained when the user can't vote.
}
addNotificationGroup(args, notification, englishFile, entry);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,10 @@ private void internalSetVoteForValue(

@Override
public boolean userDidVote(User myUser, String somePath) {
if (myUser == null || myUser.id == UserRegistry.NO_USER) {
// if there is no user, by definition the user did not vote.
return false;
}
PerXPathData xpd = peekXpathData(somePath);
return (xpd != null && xpd.userDidVote(myUser));
}
Expand Down
Loading