Skip to content
Closed
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
67 changes: 6 additions & 61 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- 9200:9200

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4

- name: update apt
run: sudo apt-get update -y
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
javascript-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4

- name: Build the Docker image
env:
Expand Down Expand Up @@ -205,7 +205,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4

- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
Expand All @@ -229,7 +229,7 @@ jobs:
GENERATOR_OUTPUT_DIR_VC: ./frontends/api/src/generated/v0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
Expand Down Expand Up @@ -268,7 +268,7 @@ jobs:
GENERATOR_OUTPUT_DIR_VC: ./frontends/api/src/generated/v1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
Expand Down Expand Up @@ -296,58 +296,3 @@ jobs:
run: |
diff $GENERATOR_OUTPUT_DIR_CI $GENERATOR_OUTPUT_DIR_VC \
|| { echo "OpenAPI spec is out of date. Please regenerate via ./scripts/generate_openapi.sh"; exit 1; }

e2e-tests:
# Disabling the E2E tests for now
if: false
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
cache: yarn
cache-dependency-path: e2e_testing/yarn.lock

- name: Install frontend dependencies
run: yarn install --immutable

- name: Build frontend
run: NODE_ENV=production yarn build

- name: Build exported components
run: NODE_ENV=production yarn workspace mit-learn build-exports

- name: Build services
run: docker compose -f docker-compose-e2e-tests.yml build

- name: Start services
run: docker compose -f docker-compose-e2e-tests.yml up nginx web --detach --wait

- name: Apply test data
run: ./e2e_testing/scripts/apply-fixtures.sh

- name: Install E2E test dependencies
working-directory: e2e_testing
run: yarn install --immutable

- name: Install Playwright browsers
working-directory: e2e_testing
run: yarn playwright install --with-deps chromium

- name: Run E2E tests
working-directory: e2e_testing
run: BASE_URL=http://localhost:8063 CI=true yarn test

- name: Setup Pages
if: always()
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5

- name: Upload artifact
if: always()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: playwright-report
path: e2e_testing/playwright-report
4 changes: 2 additions & 2 deletions .github/workflows/openapi-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout HEAD
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
ref: ${{ github.head_ref }}
path: head
- name: Checkout BASE
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
ref: ${{ github.base_ref }}
path: base
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
ref: release

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4

- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
ref: release-candidate

Expand Down
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,5 @@ github-pages/public
# Storybook
storybook-static/

/e2e_testing/test-results/
/e2e_testing/playwright-report/
/e2e_testing/blob-report/
/e2e_testing/playwright/.cache/
!/e2e_testing/.env

/**/.yarn/cache
e2e_testing/.yarn/cache
.swc
725 changes: 367 additions & 358 deletions .yarn/releases/yarn-4.5.0.cjs → .yarn/releases/yarn-4.5.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.5.0.cjs
yarnPath: .yarn/releases/yarn-4.5.1.cjs

# https://github.com/vitejs/vite-plugin-react-swc/issues/74#issuecomment-1520484130
# https://github.com/swc-project/swc/issues/5616#issuecomment-1265639797
Expand Down
36 changes: 0 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,42 +251,6 @@ Personal API keys only need read permission to Query. When creating a personal A

Once these are set (and you've restarted the app), you should see events flowing into the PostHog dashboard.

## Exported Components

A Javascript bundle of exported frontend components can be generated for use in external websites that have CORS allowance into a given instance of `mit-learn`. There are a few settings you might want to change in order to get the expected results.

- `MITOL_AXIOS_WITH_CREDENTIALS` - This sets `withCredentials: true` when initializing the Axios API, which tells the end user's browser to send along any browser level cookies for the current domain when making CORS requests
- `MITOL_API_BASE_URL` - This sets the base url used for API requests, which will need to be set to a fully qualified url pointing to an instance of `mit-learn` (i.e. https://learn.mit.edu) in order for requests from the external site to reach the proper destination
- `CORS_ALLOWED_ORIGINS`, `CSRF_TRUSTED_ORIGINS` - On the instance of `mit-learn` that the externally hosted components will access via the API, the domains of any sites that need CORS access need to be here as a list of strings

To build the bundle of exported components, run:

```
yarn workspace mit-learn build-exports
```

The bundle will build out to `frontends/mit-learn/build-exports/`

### `initMitOpenDom`

This function takes an argument of an `HTMLElement` with which `mit-learn` components will mount into.

### `openAddToUserListDialog`

This function opens a modal for adding a given `LearningResource` to a `UserList`, given the `readable_id` of the `LearningResource` object. Given a div with an ID of `mit-learn-components` and a button with the ID for `add-to-user-list-button`, you would use it in combination with `initMitOpenDom` like this:

```javascript
import { initMitOpenDom, openAddToUserListDialog } from "mit-learn-components"

$("#add-to-user-list-button").on("click", async (event) => {
event.preventDefault()
await initMitOpenDom($("#mit-learn-components"))
await openAddToUserListDialog("18.700+fall_2013")
})
```

This is just an example, and you could input any `readable_id` to bring up a dialog to add any given `LearningResource` object to a `UserList`.

## GitHub Pages Storybook

Demos and documentation of reusable UI components in this repo are published as a [storybook](https://storybook.js.org/) at https://mitodl.github.io/mit-learn/.
17 changes: 17 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
Release Notes
=============

Version 0.23.1
--------------

- Update dependency urllib3 to v2 (#1741)
- ol-template is not used (#1738)
- Update dependency @faker-js/faker to v9 (#1735)
- Update dependency faker to v30 (#1732)
- Update dependency toolz to v1 (#1733)
- Fixes to make learn work with scim-for-keycloak (#1727)
- Navigation Accessibility (#1726)
- Middleware for SSL redirect (#1729)
- Clean out the static frontend (#1731)
- Update Yarn to v4.5.1 (#1716)
- Search count inside label (#1730)
- Announce search count for screen readers (#1713)
- Update actions/checkout digest to eef6144 (#1686)

Version 0.23.0 (Released October 22, 2024)
--------------

Expand Down
14 changes: 14 additions & 0 deletions authentication/backends/ol_open_id_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@ class OlOpenIdConnectAuth(OpenIdConnectAuth):
"""

name = "ol-oidc"

def get_user_details(self, response):
"""Get the user details from the API response"""
details = super().get_user_details(response)

return {
**details,
"profile": {
"name": response.get("name", ""),
"email_optin": bool(int(response["email_optin"]))
if "email_optin" in response
else None,
},
}
2 changes: 1 addition & 1 deletion authentication/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AuthenticationHooks:
"""Pluggy hooks specs for authentication"""

@hookspec
def user_created(self, user):
def user_created(self, user, user_data):
"""Trigger actions after a user is created"""


Expand Down
7 changes: 5 additions & 2 deletions authentication/pipeline/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from social_core.exceptions import AuthException

from authentication.hooks import get_plugin_manager
from profiles import api as profile_api


def forbid_hijack(
Expand All @@ -23,14 +24,16 @@ def forbid_hijack(
return {}


def user_created_actions(**kwargs):
def user_created_actions(*, user, details, **kwargs):
"""
Trigger plugins when a user is created
"""
if kwargs.get("is_new"):
pm = get_plugin_manager()
hook = pm.hook
hook.user_created(user=kwargs["user"])
hook.user_created(user=user, user_data=details)
else:
profile_api.ensure_profile(user=user, profile_data=details.get("profile", {}))


def user_onboarding(*, backend, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions authentication/pipeline/user_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_user_created_actions(mocker, is_new):
kwargs = {
"user": user,
"is_new": is_new,
"details": {},
}

user_actions.user_created_actions(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion channels/views_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def test_patch_channel_image(client, channel, attribute):
os.path.dirname(__file__), # noqa: PTH120
"..",
"frontends",
"mit-learn",
"main",
"public",
"images",
"blank.png",
Expand Down
10 changes: 0 additions & 10 deletions config/static-app.conf

This file was deleted.

Loading
Loading