Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8c3357b
Update actions/checkout digest to eef6144 (#1686)
renovate[bot] Oct 22, 2024
f620c3a
Announce search count for screen readers (#1713)
ChristopherChudzicki Oct 22, 2024
47ee91e
Search count inside label (#1730)
ChristopherChudzicki Oct 23, 2024
5bd52bd
Update Yarn to v4.5.1 (#1716)
renovate[bot] Oct 23, 2024
c0ac29b
Clean out the static frontend (#1731)
jonkafton Oct 23, 2024
739b5bd
Middleware for SSL redirect (#1729)
jonkafton Oct 23, 2024
a066cc5
Navigation Accessibility (#1726)
ChristopherChudzicki Oct 24, 2024
b225c97
Fixes to make learn work with scim-for-keycloak (#1727)
rhysyngsun Oct 24, 2024
3519a74
Update dependency toolz to v1 (#1733)
renovate[bot] Oct 24, 2024
e9799f5
Update dependency faker to v30 (#1732)
renovate[bot] Oct 24, 2024
69f4893
Update dependency @faker-js/faker to v9 (#1735)
renovate[bot] Oct 24, 2024
86723a8
ol-template is not used (#1738)
abeglova Oct 24, 2024
dbf6984
Update dependency urllib3 to v2 (#1741)
renovate[bot] Oct 24, 2024
7dbe5a7
Update dependency moto to v5 (#1740)
renovate[bot] Oct 24, 2024
f5206f1
Update opensearchproject/opensearch Docker tag to v2.17.1 (#1746)
renovate[bot] Oct 24, 2024
4f22720
Update dependency ruff to v0.7.1 (#1745)
renovate[bot] Oct 24, 2024
4bdc2d2
Update dependency pygithub to v2 (#1748)
renovate[bot] Oct 24, 2024
4e60468
remove elasticsearch (#1734)
abeglova Oct 25, 2024
073bce9
fix list duplication when editing lists (#1749)
ChristopherChudzicki Oct 25, 2024
e27f1f2
restore images in subscription emails (#1747)
shanbady Oct 25, 2024
37665d5
Release 0.23.1
odlbot Oct 25, 2024
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
80 changes: 6 additions & 74 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,8 @@ jobs:
ports:
- 6379:6379

elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:8.15.1
env:
network.host: "0.0.0.0"
http.cors.enabled: "true"
http.cors.allow-origin: "*"
http.max_content_length: "10mb"
rest.action.multi.allow_explicit_index: "false"
ES_JAVA_OPTS: "-Xms1024m -Xmx1024m"
discovery.type: "single-node"
ports:
- 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 +88,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 +147,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 +192,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 +216,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 +255,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 +283,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/.
24 changes: 24 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
Release Notes
=============

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

- restore images in subscription emails (#1747)
- fix list duplication when editing lists (#1749)
- remove elasticsearch (#1734)
- Update dependency pygithub to v2 (#1748)
- Update dependency ruff to v0.7.1 (#1745)
- Update opensearchproject/opensearch Docker tag to v2.17.1 (#1746)
- Update dependency moto to v5 (#1740)
- 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