From 2d85fc50c1d087f991acae4667d9e6bb47c972eb Mon Sep 17 00:00:00 2001 From: Laura Coursen Date: Mon, 18 Oct 2021 14:47:13 -0500 Subject: [PATCH 1/3] Add "Permissions" section to "Word choice and terminology" in the style guide (#22251) --- contributing/content-style-guide.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/contributing/content-style-guide.md b/contributing/content-style-guide.md index 64c6ef3b31..ff56f2b8d7 100644 --- a/contributing/content-style-guide.md +++ b/contributing/content-style-guide.md @@ -467,6 +467,35 @@ Where the first reference concerns `cents` or a non-dollar amount, capitalize th See the “Inclusive language” section of this guide. +### Permissions + +A **permission** is the ability to perform a specific action. For example, the ability to delete an issue is a permission. + +A **role** is a set of permissions that can be assigned to a user. Roles exist at different levels. + +- Accounts (e.g., organization owner, billing manager for an enterprise account) +- Resources (e.g., "Write" for a repository, "Admin" for a security advisory) +- Teams (e.g., "team maintainer") + +A person's **access** refers generally to all the abilities the person has in a particular context, regardless of which roles or individual permissions those abilities come from. + +Only use **permission** or **role** when the distinction between the two is important. Otherwise, use **access**. + +- **Use:** `To create a custom repository role, you choose an inherited role and then add individual permissions.` +- **Use:** `Managing a team's access to your organization's repository` +- **Use:** `If your team membership gives you a different level of access than your role as organization owner...` +- **Use:** `People with write access can...` +- **Avoid:** `People with the write role can...` +- **Avoid:** `People with write permissions can...` +- **Avoid:** `People with write privileges can...` + +When specifying the access required to take an action, refer only to the role at the same level as the action. For example, you need admin access to a repository, which is a repository-level role, to configure protected branches. You can get admin access to a repository by being an organization owner, an organization-level role, but the repository-level role is what actually governs your ability to take the action, so that is the only role that should be mentioned. + +- **Use:** `People with write access to a repository can do X to the repository.` +- **Avoid:** `Organization owners and people with write access can do X to the repository.` + +For more information about word choice for permissions statments, see "[Permissions statements](/contributing/content-model.md#permissions-statements)" in the content model. + ### Prepositions Avoid ending a sentence with a preposition unless the rewritten sentence would sound awkward or too formal. From 9964a6619ca9eb72996cc1abb0cc8be4b11c65a7 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 18 Oct 2021 15:58:56 -0400 Subject: [PATCH 2/3] separate 'npm test' from 'npm lint' (#22191) * separate 'npm test' from 'npm lint' * remove delberately eslint violation (but keep prettier violation) * undo prettier violation * tighten up us of our scripts for testing and lint --- .github/workflows/js-lint.yml | 2 +- .github/workflows/test-windows.yml | 4 +--- .github/workflows/test.yml | 4 +--- package.json | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/js-lint.yml b/.github/workflows/js-lint.yml index c0d2169959..da7881c647 100644 --- a/.github/workflows/js-lint.yml +++ b/.github/workflows/js-lint.yml @@ -28,4 +28,4 @@ jobs: run: npm ci - name: Run linter - run: npx eslint . + run: npm run lint diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index e86e0ed038..20d7e2d2cd 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -52,6 +52,4 @@ jobs: run: npm run build - name: Run tests - run: npx jest tests/${{ matrix.test-group }}/ - env: - NODE_OPTIONS: '--max_old_space_size=8192' + run: npm run test tests/${{ matrix.test-group }}/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f437fc6a63..3d2ac16e25 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,6 +57,4 @@ jobs: run: npm run build - name: Run tests - run: npx jest tests/${{ matrix.test-group }}/ - env: - NODE_OPTIONS: '--max_old_space_size=8192 --experimental-vm-modules' + run: npm run test tests/${{ matrix.test-group }}/ diff --git a/package.json b/package.json index e391dcc8f2..9c6c962e89 100644 --- a/package.json +++ b/package.json @@ -221,7 +221,7 @@ "sync-search-ghes-release": "cross-env GHES_RELEASE=1 start-server-and-test sync-search-server 4002 sync-search-indices", "sync-search-indices": "script/sync-search-indices.js", "sync-search-server": "cross-env NODE_ENV=production WEB_CONCURRENCY=1 PORT=4002 node server.mjs", - "test": "npm run lint && cross-env NODE_OPTIONS=--experimental-vm-modules jest", + "test": "cross-env NODE_OPTIONS='--max_old_space_size=8192 --experimental-vm-modules' jest", "test-watch": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --watch --notify --notifyMode=change --coverage" }, "lint-staged": { From 1d72d4c87ebfa69cb01a6879bb041d08e3c4c5f3 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 18 Oct 2021 16:09:20 -0400 Subject: [PATCH 3/3] use temporary redirect to inject locale prefix (#22239) * use temporary redirect to inject locale prefix Fixes #996 * fix routing tests --- middleware/redirects/handle-redirects.js | 2 +- tests/rendering/server.js | 2 +- tests/routing/redirects.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/middleware/redirects/handle-redirects.js b/middleware/redirects/handle-redirects.js index 35da319b13..028c2ba895 100644 --- a/middleware/redirects/handle-redirects.js +++ b/middleware/redirects/handle-redirects.js @@ -19,7 +19,7 @@ export default function handleRedirects(req, res, next) { language = req.context.userLanguage } - return res.redirect(301, `/${language}`) + return res.redirect(302, `/${language}`) } // begin redirect handling diff --git a/tests/rendering/server.js b/tests/rendering/server.js index fa4a2e1f4a..66928021ac 100644 --- a/tests/rendering/server.js +++ b/tests/rendering/server.js @@ -631,7 +631,7 @@ describe('server', () => { test('redirects / to /en', async () => { const res = await get('/') - expect(res.statusCode).toBe(301) + expect(res.statusCode).toBe(302) expect(res.headers.location).toBe('/en') }) diff --git a/tests/routing/redirects.js b/tests/routing/redirects.js index fd5ea695e9..603c4fe14c 100644 --- a/tests/routing/redirects.js +++ b/tests/routing/redirects.js @@ -131,13 +131,13 @@ describe('redirects', () => { describe('home page redirects', () => { test('homepage redirects to english by default', async () => { const res = await get('/') - expect(res.statusCode).toBe(301) + expect(res.statusCode).toBe(302) expect(res.headers.location).toBe('/en') }) test('homepage redirects to preferred language', async () => { const res = await get('/', { headers: { 'Accept-Language': 'ja' } }) - expect(res.statusCode).toBe(301) + expect(res.statusCode).toBe(302) expect(res.headers.location).toBe('/ja') }) })