From eef9d1df193d85b51d57413da272ca545a69b0d3 Mon Sep 17 00:00:00 2001 From: ChengGeng97 <47176493+ChengGeng97@users.noreply.github.com> Date: Tue, 15 Jun 2021 14:22:57 +0800 Subject: [PATCH 1/4] fix: disable teacher mode if student is member of organization --- .../GitHubAssessmentWorkspace.tsx | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/pages/githubAssessments/GitHubAssessmentWorkspace.tsx b/src/pages/githubAssessments/GitHubAssessmentWorkspace.tsx index bd37590f9a..3e7b3d87e5 100644 --- a/src/pages/githubAssessments/GitHubAssessmentWorkspace.tsx +++ b/src/pages/githubAssessments/GitHubAssessmentWorkspace.tsx @@ -270,21 +270,6 @@ const GitHubAssessmentWorkspace: React.FC = prop .then((authenticatedUser: any) => { const userLogin = authenticatedUser.data.login; return userLogin === missionRepoData.repoOwner; - }) - .then(async (userOwnsRepo: boolean) => { - if (userOwnsRepo) return true; - - const userOrganisations = (await octokit.orgs.listForAuthenticatedUser()).data; - let userOrganisationOwnsRepo = false; - for (let i = 0; i < userOrganisations.length; i++) { - const org = userOrganisations[i]; - // User has admin access to an organization owning the repo - userOrganisationOwnsRepo = org.login === missionRepoData.repoOwner; - if (userOrganisationOwnsRepo) { - break; - } - } - return userOrganisationOwnsRepo; }); const promises = [missionDataPromise, isTeacherModePromise]; From 38ab4cd5ac4219760a8af4d39b6ea9083e243431 Mon Sep 17 00:00:00 2001 From: ChengGeng97 <47176493+ChengGeng97@users.noreply.github.com> Date: Tue, 15 Jun 2021 14:25:08 +0800 Subject: [PATCH 2/4] style: yarn run format --- .../githubAssessments/GitHubAssessmentWorkspace.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pages/githubAssessments/GitHubAssessmentWorkspace.tsx b/src/pages/githubAssessments/GitHubAssessmentWorkspace.tsx index 3e7b3d87e5..9b284a260d 100644 --- a/src/pages/githubAssessments/GitHubAssessmentWorkspace.tsx +++ b/src/pages/githubAssessments/GitHubAssessmentWorkspace.tsx @@ -265,12 +265,10 @@ const GitHubAssessmentWorkspace: React.FC = prop if (octokit === undefined) return; const missionDataPromise = getMissionData(missionRepoData, octokit); - const isTeacherModePromise = octokit.users - .getAuthenticated() - .then((authenticatedUser: any) => { - const userLogin = authenticatedUser.data.login; - return userLogin === missionRepoData.repoOwner; - }); + const isTeacherModePromise = octokit.users.getAuthenticated().then((authenticatedUser: any) => { + const userLogin = authenticatedUser.data.login; + return userLogin === missionRepoData.repoOwner; + }); const promises = [missionDataPromise, isTeacherModePromise]; From 11d3a16cb72f6880c6ca6a55a7d3a5bca2fa6f19 Mon Sep 17 00:00:00 2001 From: Martin Henz Date: Wed, 16 Jun 2021 13:27:59 +0800 Subject: [PATCH 3/4] avoid the word 'code' (#1795) --- .../GitHubAssessmentDefaultValues.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/githubAssessments/GitHubAssessmentDefaultValues.ts b/src/pages/githubAssessments/GitHubAssessmentDefaultValues.ts index 0b1255ff94..ec1468b695 100644 --- a/src/pages/githubAssessments/GitHubAssessmentDefaultValues.ts +++ b/src/pages/githubAssessments/GitHubAssessmentDefaultValues.ts @@ -15,11 +15,11 @@ Everything here is written in Markdown. This means that you can **bolden** or *italicize* text by adding asterisks. -Code-blocks can be formatted through the use of backticks: +Programs can be formatted through the use of triple backticks: \`\`\` -// This is a code example +// This is a program example \`\`\` -If you want to in-line code, rather than display a whole code-block, you can also do \`this\`. +If you want to in-line program snippets, rather than display it as a block, you can also use single backticks like \`this\`. Lists can be created by adding dashes to the start of a line: - First element @@ -48,11 +48,11 @@ Everything here is written in Markdown. This means that you can **bolden** or *italicize* text by adding asterisks. -Code-blocks can be formatted through the use of backticks: +Programs can be formatted through the use of triple backticks: \`\`\` -// This is a code example +// This is a program example \`\`\` -If you want to in-line code, rather than display a whole code-block, you can also do \`this\`. +If you want to in-line program snippets, rather than display it as a block, you can also use single backticks like \`this\`. Lists can be created by adding dashes to the start of a line: - First element @@ -67,7 +67,7 @@ It is also possible to embed images, like this: If you need a more detailed cheatsheet, please click [here](https://www.markdownguide.org/cheat-sheet/)! `; -export const defaultStarterCode = '// Your code here!\n'; +export const defaultStarterCode = '// Your program here!\n'; export const defaultMissionMetadata = { coverImage: '', From c32eaff29f09b3d744d2269ce2b72a88d5dd5f40 Mon Sep 17 00:00:00 2001 From: Samuel Fang Date: Wed, 16 Jun 2021 14:50:59 +0800 Subject: [PATCH 4/4] Fix 404 bug for SICP-JS pages (#1794) * Add symbolic links from sicp pages to index * Add newline to eof --- .github/workflows/build-development.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-development.yml b/.github/workflows/build-development.yml index b66cc76cf2..482b8b146c 100644 --- a/.github/workflows/build-development.yml +++ b/.github/workflows/build-development.yml @@ -37,12 +37,6 @@ jobs: run: | yarn install yarn run build - ln -s index.html build/playground.html - ln -s index.html build/contributors.html - ln -s index.html build/sourcecast.html - ln -s index.html build/interactive-sicp.html - # the `ln`s above are a hack to make GitHub Pages route /playground - # and /contributors etc to index, instead of 404-ing. env: REACT_APP_URL_SHORTENER_SIGNATURE: ${{ secrets.REACT_APP_URL_SHORTENER_SIGNATURE }} REACT_APP_URL_SHORTENER_DOMAIN: ${{ secrets.REACT_APP_URL_SHORTENER_DOMAIN }} @@ -60,7 +54,20 @@ jobs: PUBLIC_URL: "https://source-academy.github.io" REACT_APP_GITHUB_OAUTH_PROXY_URL: ${{ secrets.REACT_APP_GITHUB_OAUTH_PROXY_URL }} REACT_APP_GITHUB_CLIENT_ID: ${{ secrets.REACT_APP_GITHUB_CLIENT_ID }} - + - name: Create symbolic links + run: | + set -euxo pipefail + ln -s index.html build/playground.html + ln -s index.html build/contributors.html + ln -s index.html build/sourcecast.html + ln -s index.html build/interactive-sicp.html + mkdir -p build/interactive-sicp + declare -a arr=("index" "foreword" "prefaces03" "prefaces84" "prefaces96" "acknowledgements" "1" "1.1" "1.1.1" "1.1.2" "1.1.3" "1.1.4" "1.1.5" "1.1.6" "1.1.7" "1.1.8" "1.2" "1.2.1" "1.2.2" "1.2.3" "1.2.4" "1.2.5" "1.2.6" "1.3" "1.3.1" "1.3.2" "1.3.3" "1.3.4" "2" "2.1" "2.1.1" "2.1.2" "2.1.3" "2.1.4" "2.2" "2.2.1" "2.2.2" "2.2.3" "2.2.4" "2.3" "2.3.1" "2.3.2" "2.3.3" "2.3.4" "2.4" "2.4.1" "2.4.2" "2.4.3" "2.5" "2.5.1" "2.5.2" "2.5.3" "3" "3.1" "3.1.1" "3.1.2" "3.1.3" "3.2" "3.2.1" "3.2.2" "3.2.3" "3.2.4" "3.3" "3.3.1" "3.3.2" "3.3.3" "3.3.4" "3.3.5" "3.4" "3.4.1" "3.4.2" "3.5" "3.5.1" "3.5.2" "3.5.3" "3.5.4" "3.5.5" "4" "4.1" "4.1.1" "4.1.2" "4.1.3" "4.1.4" "4.1.5" "4.1.6" "4.1.7" "4.2" "4.2.1" "4.2.2" "4.2.3" "4.3" "4.3.1" "4.3.2" "4.3.3" "4.4" "4.4.1" "4.4.2" "4.4.3" "4.4.4" "5" "5.1" "5.1.1" "5.1.2" "5.1.3" "5.1.4" "5.1.5" "5.2" "5.2.1" "5.2.2" "5.2.3" "5.2.4" "5.3" "5.3.1" "5.3.2" "5.4" "5.4.1" "5.4.2" "5.4.3" "5.4.4" "5.5" "5.5.1" "5.5.2" "5.5.3" "5.5.4" "5.5.5" "5.5.6" "5.5.7" "references" "making-of") + for i in "${arr[@]}"; do + ln -s ../index.html build/interactive-sicp/$i.html + done + # the `ln`s above are a hack to make GitHub Pages route /playground + # and /contributors etc to index, instead of 404-ing. - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: