-
Notifications
You must be signed in to change notification settings - Fork 384
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-16499 Prepare to Require a CLA for contributions #3653
Changes from 9 commits
5f502b4
f146c55
99a5e8e
8e0c21b
f490498
1d94fd0
6b29eec
2ea59c6
3c6b88c
ad081a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import * as cldrClient from "../esm/cldrClient.mjs"; | ||
import * as cldrNotify from "../esm/cldrNotify.mjs"; | ||
/** | ||
* see ClaSignature.java | ||
* @typedef {Object} ClaSignature | ||
* @property {boolean} corporate true if a corporate signature | ||
* @property {string} email | ||
* @property {string} employer | ||
* @property {string} name | ||
* @property {boolean} unauthorized true if cla load failed | ||
* @property {boolean} readonly true if cla may not be modified | ||
* @property {boolean} signed true if signed, always true when returned from getCla() | ||
*/ | ||
|
||
/** @return {ClaSignature} signed cla if present otherwise null if not accessible */ | ||
export async function getCla() { | ||
try { | ||
const client = await cldrClient.getClient(); | ||
const { body } = await client.apis.user.getCla(); | ||
return body; | ||
} catch (e) { | ||
if (e.statusCode === 401) { | ||
return { unauthorized: true }; | ||
} else if (e.statusCode === 404) { | ||
return { signed: false }; | ||
} else { | ||
cldrNotify.exception(e, `trying to load CLA`); | ||
throw e; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Attempt to sign. | ||
* @throws {statusCode: 423} if the CLA may not be modified | ||
* @throws {statusCode: 406} if there is an imput validation error | ||
* @param {ClaSignature} cla | ||
* @returns nothing if successful | ||
*/ | ||
export async function signCla(cla) { | ||
const client = await cldrClient.getClient(); | ||
const result = await client.apis.user.signCla( | ||
{}, | ||
{ | ||
requestBody: cla, | ||
} | ||
); | ||
} | ||
|
||
/** | ||
* Attempt to revoke. | ||
* @throws {statusCode: 423} if the CLA may not be modified | ||
* @throws {statusCode: 404} if the CLA was never signed | ||
*/ | ||
export async function revokeCla() { | ||
const client = await cldrClient.getClient(); | ||
const result = await client.apis.user.revokeCla(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# CLA not needed | ||
|
||
The SurveyTool is not currently requiring a CLA. | ||
For more details about the CLA, see [policy](https://www.unicode.org/policies/licensing_policy.html) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
{{ unreadAnnouncementCount }}</a | ||
> | ||
</li> | ||
<li v-if="coverageLevel"> | ||
<li v-if="coverageLevel && !needCla"> | ||
<label for="coverageLevel">Coverage:</label> | ||
<select | ||
id="coverageLevel" | ||
|
@@ -30,7 +30,7 @@ | |
</option> | ||
</select> | ||
</li> | ||
<li v-if="voteCountMenu && voteCountMenu.length"> | ||
<li v-if="voteCountMenu && voteCountMenu.length && !needCla"> | ||
<label for="voteLevelChanged">Votes:</label> | ||
<select | ||
id="voteLevelChanged" | ||
|
@@ -47,6 +47,13 @@ | |
>Instructions</a | ||
> | ||
</li> | ||
<a-alert | ||
v-if="needCla" | ||
@click="showCla" | ||
message="CLA must be signed before data can be input" | ||
type="error" | ||
show-icon | ||
/> | ||
<li id="st-special-header" class="specialmessage">{{ specialHeader }}</li> | ||
<li> | ||
<a | ||
|
@@ -101,6 +108,7 @@ export default { | |
userName: null, | ||
voteCountMenu: null, | ||
voteLevelChanged: 0, | ||
needCla: false, | ||
}; | ||
}, | ||
|
||
|
@@ -153,6 +161,10 @@ export default { | |
this.voteCountMenu = null; | ||
this.voteLevelChanged = 0; | ||
} | ||
|
||
// only need CLA if logged in | ||
this.needCla = !!user && !user.claSigned; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm guessing that if DO_NOT_REQURE_CLA is true on the back end, then user.claSigned will get true (or truthy Date object?), even though that's sort of a fiction... OK, I've confirmed that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
|
||
this.sessionMessage = cldrStatus.getSessionMessage(); | ||
this.specialHeader = cldrStatus.getSpecialHeader(); | ||
this.stVersionPhase = | ||
|
@@ -177,6 +189,10 @@ export default { | |
? "You have " + n + " unread announcement(s)" | ||
: ""; | ||
}, | ||
|
||
showCla() { | ||
window.location.replace("#cla///"); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on the back end, it looks like "signed" is a Date rather than boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, that should be the date signed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should that still be changed to a date, then?