2472 Commits

Author SHA1 Message Date
49e6caf79a Prevent error during RfC create when navigating
Previously, an error could occur when creating an RfC. The erroneous behavior was triggered with the following steps:

1. A learner is on the implement page
2. They click on another link to leave the current page
3. Before the new page opens (through Turbolinks), the "request comments" button was hit
4. Still before the new page was visible, a question was entered and the RfC was submitted.
5. The new page opens
6. Creating the RfC was successful, and a code run should be triggered (as well as hiding the question modal etc.)

With this commit, we still allow creating an RfC without error even if the page was left before everything finished.

Fixes CODEOCEAN-FRONTEND-9C
2024-07-08 17:59:58 +02:00
90897a24e5 Correctly set hidden_feedback for inherited files
Without this fix, hidden_feedback was only effective when read_only was set, too.
2024-07-08 17:58:46 +02:00
996d4674e0 Disable footnote backlinks in Markdown
These backlinks don't work reliably and are thus more harmful than useful.
2024-07-01 16:42:53 +02:00
fea8b5d6f6 Migrate RailsAdmin assets to Shakapacker
Resolves an issue with a strict CSP disabling inline `data` images. With Shakapacker and our current webpack config, we extract inline `data` images to dedicated files, thus resolving the issue.
2024-06-17 15:25:21 +02:00
092487344a Replace obsolete HTTP status code :unprocessable_entity
The new naming is :unprocessable_content and required by Rack 3.1+
2024-06-17 15:07:04 +02:00
4e1e8c0f4d Fix Rubocop offenses 2024-06-17 15:07:04 +02:00
9dd3f94d04 Fix incorrect translation on exercise edit 2024-06-17 14:44:16 +02:00
db966eeb9d Capture non-JSON error in newSentryTransaction
Using the JSON representation of the error only works for some errors, whereas others are simply marked with a {}. Still, we attach the JSON representation to the Sentry event captured.
2024-06-17 14:40:56 +02:00
a99d86068a Refactor newSentryTransaction to use improved API
This change is based on a suggestion by Sentry staff. It requires SDK version > 8.4.0

https://github.com/getsentry/sentry-javascript/issues/12116#issuecomment-2132812315
https://github.com/getsentry/sentry-javascript/pull/12138
2024-05-28 15:08:47 +02:00
e20ee45464 Prevent duplicate error handling for WebSocket events 2024-05-27 09:43:41 +02:00
c5b774f752 Convert errors captured with Sentry to JSON 2024-05-26 10:28:26 +02:00
0b1cb3affa Fix removal of event listeners for runSocket
The code previously used was only working with the patched Sentry method, not when Sentry was inactive. Since a Websocket is inheriting from EventTarget, the method signature usually requires two arguments.

See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener
2024-05-26 10:28:16 +02:00
d0fcb6d695 Explicitly state permissions for CommunitySolutionPolicy 2024-05-24 15:21:11 +02:00
94404370c4 Upgrade Sentry to v8 and remove custom Dependabot grouping
As part of the upgrade process, we need to rework the tracing instrumentation. Now, we are just wrapping all async functions in a new sentry transaction, which will automatically end once the function returns.

Further, the structure of the Sentry packages got reworked, so that we only need a single package by now. This removes the need to group dependabot updates.

Co-authored-by: Jan Graichen <jgraichen@altimos.de>
2024-05-24 14:52:14 +02:00
86c67f3c9a Refactor code execution to use async functions
This refactoring is required for Sentry tracing. It ensures that the respective functions only return as soon as a code execution finished. With this approach, we can then instrument the duration of the functions, so that Sentry spans are created as desired.

Co-authored-by: Jan Graichen <jgraichen@altimos.de>
2024-05-24 14:52:14 +02:00
c8609e5392 Remove leftovers from CommunitySubmission code
This code was unintentionally copied over and was never useful (since we won't execute code when submitting a community solution).

Co-authored-by: Jan Graichen <jgraichen@altimos.de>
2024-05-24 14:52:14 +02:00
61513cc5bc Revert "Fix race condition on JavaScript initializer"
This reverts commit 88c6be88, since it is no longer needed after fixing the root cause in a076da41.
2024-05-21 21:56:31 +02:00
619291c647 Specify the order of JavaScript assets loaded.
Previously, we could face (a rare) race condition with the wrong order. This was caused by Turbolinks and our usage of "components" (e.g., the CodeOceanEditor).

It could happen that Turbolinks fired the `turbolinks:load` event, as all XHR requests finished. In the event handler, we sometimes referred to other components. However, those components weren't initialized yet, potentially. This is due to Sprockets concatenating files in alphabetical order, ignoring our component dependencies.

With this commit, we try to specify the required order and thus aim to implement a permanent fix.

Fixes CODEOCEAN-FRONTEND-7W
Fixes CODEOCEAN-FRONTEND-7D
2024-05-21 21:56:31 +02:00
65416934ea Explicitly specify depend_on relationship between assets and config 2024-05-21 21:56:31 +02:00
336519b21d Refactor CodeOcean::Config class
The new architecture memorizes settings (which we mostly did after reading the config so far) and also exposes the resulting file path as well as further settings.

This change is a prerequisite to define a dependency with Sprockets.
2024-05-21 21:56:31 +02:00
dcaedfa9fe Remove url_helpers from editor.js.erb
- Rather than using a Rails helper, we rely on JsRoutes to provide the route.
- There is no need to remove the events_path if sending events is disabled, so we drop that.
2024-05-21 21:56:31 +02:00
8c506cd47c Add AuthenticationToken to UserMailer.exercise_anomaly_detected 2024-05-21 20:10:00 +02:00
ed69da10da Prefer gender-neutral language for German 2024-05-21 19:56:58 +02:00
f8330b39fb Replace manual activerecord translations with helpers 2024-05-21 19:42:26 +02:00
e551c8a699 Reorder translations and add missing prefixes
- files should be prefixed with code_ocean/
- the markdown editor is part of the application (helper)
2024-05-21 19:42:26 +02:00
1589c9472b Fix missing and unused i18n translations 2024-05-21 19:42:26 +02:00
c6d077ecfe Add missing parentheses to external user statistics slider
Previously, no space was present for the `- 1`, changing the semantics. After linting with 9a9efd5c, a space was added, which requires parentheses.
2024-05-21 11:56:54 +02:00
189f9e28d7 Fix margin for "Administration" menu on small screens 2024-05-21 11:52:58 +02:00
7b769a7673 Enable strict CSP support for ACE
With these changes, ACE no longer requires custom inline styles, removing one further dependency from our CSP style list.
2024-04-26 13:37:25 +02:00
3bfce7f1cb Fix ACE import for Webpack, allowing Web Workers
The previous method worked correctly most of the time, but failed to resolve nested files correctly. This prevented Web Workers from functioning as expected.
2024-04-26 13:37:25 +02:00
f42c56042c Enable Web Worker for ACE editor 2024-04-26 13:37:25 +02:00
4ba5f0d7d8 Enable Web Worker for JStree 2024-04-26 13:37:25 +02:00
da9add4a10 Fix ToastUI editor bug preventing manual codeblock insertion
Manually inserting a codeblock adding three backticks and hitting enter
is not functioning in the ToastUI editor due to an existing bug in the library.
This commit implements a workaround to address the issue.
2024-04-26 13:31:49 +02:00
749074fec0 Add functionality to expand the markdown editor
The editor will now have a default height of 300px but a button will let
the user expand the editor. It will expand it to fit all content (or up
to 400px if the content was not exceeding 300px). In the expanded mode
the editor will keep growing as the user types more content.
2024-04-26 13:31:49 +02:00
f10bcb96a6 Replace Ace Editor with ToastUi editor in the ExecutionEnvironments form
Drop unused code related to the Ace markdown editor.
2024-04-26 13:31:49 +02:00
17a4485ce2 Rename PagedownFormBuilder to MarkdownFormBuilder
The term 'Pagedown' was originally associated with the pagedown-bootstrap
library, which is no longer in use.
2024-04-26 13:31:49 +02:00
0667cbeefb Drop pagedown-bootstrap library and all its related code 2024-04-26 13:31:49 +02:00
9fe18f1873 Add and customize ToastUI image insertion option
The default ToastUI image insertion feature includes both URL and file
upload options. However, file upload functionality isn't supported in
the application. This commit addresses the issue by implementing custom
code to hide the file upload button while preserving the URL insertion
option.
2024-04-26 13:31:49 +02:00
9c71c6667a Install and use ToastUi markdown editor
Replace all usages of pagedown-bootstrap editor with the new editor.
Add styles to ensure the editor preview matches the final output.
2024-04-26 13:31:49 +02:00
96f5f1f8d7 Enforce valid lis_outcome_service_url
Recently, a new institution joined CodeOcean and used a relative URL. This won't work, so that we are rejecting non-absolute URLs by now.
2024-04-26 10:21:53 +02:00
c4b7bac6c7 Fix NameError on block forward
This is a regression from 27f128ad.

Fixes CODEOCEAN-12R
2024-04-24 17:54:25 +02:00
b11b8b9e1e Fix invalid column reference for non-detailed exercise statistics
Fixes CODEOCEAN-12D
2024-04-24 17:53:27 +02:00
6e4e376c91 Fix missing linter results caused by incorrect JS loop
Fixes CODEOCEAN-FRONTEND-69
2024-04-24 17:52:46 +02:00
88c6be88f1 Fix race condition on JavaScript initializer
Previously, ProgrammingGroups could have been undefined in rare cases. Therefore, we check whether the variable is properly defined before calling the method.

Fixes CODEOCEAN-FRONTEND-7D
2024-04-24 17:23:29 +02:00
6d66376aae Fix layout for exercise description on implement route
Regresses 9a9efd5c and a7fa9b5b
2024-04-24 17:16:46 +02:00
dd7b09e1e3 Improve visual difference for solved and soft-solved RfCs 2024-04-24 12:18:47 +02:00
7cc4fb00c6 RfCs: Allow filtering for any states
We want to differentiate between those RfCs explicitly marked as solved, those potentially solved since the author reached the maximum score, and those being unsolved where the author has not yet reached the full score yet.
2024-04-24 12:18:47 +02:00
e9941d8f47 Keep indention when displaying comments 2024-04-23 22:55:20 +02:00
9a9efd5caa Lint Slim files and fix offenses
The fixing was partially done manually and partially automatically.
2024-04-18 08:31:24 +02:00
27f128ad2d Fix Rubocop offenses 2024-04-18 08:28:46 +02:00