Page MenuHomeSoftware Heritage

Handle error from server during add-forge creation request failure
ClosedPublic

Authored by ardumont on Mar 18 2022, 12:46 PM.

Details

Summary

This is:

  • plainly displaying the text message when a conflict occur.
  • parse the json response otherwise when an input failure occurs.

Screenshots:

Related to T4052

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont edited the summary of this revision. (Show Details)

Build has FAILED

Patch application report for D7378 (id=26679)

Could not rebase; Attempt merge onto 7bfbda85ff...

Merge made by the 'recursive' strategy.
 assets/src/bundles/add_forge/create-request.js     | 112 +++++
 assets/src/bundles/add_forge/index.js              |  11 +
 .../src/bundles/add_forge/moderation-dashboard.js  |  55 +++
 cypress/fixtures/add-forge-now-requests.json       |  79 ++++
 .../add-forge-now-request-create.spec.js           | 139 ++++++
 .../add-forge-now-requests-moderation.spec.js      | 122 ++++++
 cypress/integration/deposit-admin.spec.js          |  52 ++-
 cypress/support/index.js                           |   8 +
 swh/web/add_forge_now/__init__.py                  |   0
 swh/web/add_forge_now/apps.py                      |  10 +
 swh/web/add_forge_now/migrations/0001_initial.py   | 109 +++++
 swh/web/add_forge_now/migrations/__init__.py       |   0
 swh/web/add_forge_now/models.py                    |  99 +++++
 swh/web/add_forge_now/tests/test_migration.py      |  62 +++
 swh/web/add_forge_now/views.py                     | 107 +++++
 swh/web/admin/add_forge_now.py                     |  30 ++
 swh/web/admin/urls.py                              |   6 +-
 swh/web/api/urls.py                                |   1 +
 swh/web/api/views/add_forge_now.py                 | 355 +++++++++++++++
 swh/web/auth/utils.py                              |   1 +
 swh/web/common/utils.py                            |   7 +-
 swh/web/config.py                                  |   9 +
 swh/web/inbound_email/__init__.py                  |   0
 swh/web/inbound_email/apps.py                      |  11 +
 .../management/commands/process_inbound_email.py   |  73 ++++
 swh/web/inbound_email/signals.py                   |  36 ++
 swh/web/inbound_email/utils.py                     |  63 +++
 swh/web/settings/common.py                         |   2 +
 swh/web/settings/development.py                    |   9 +-
 swh/web/settings/tests.py                          |   1 +
 .../templates/add_forge_now/create-request.html    | 234 ++++++++++
 .../add_forge_now/requests-moderation.html         |  45 ++
 swh/web/templates/layout.html                      |  22 +-
 swh/web/tests/add_forge_now/test_models.py         |  26 ++
 swh/web/tests/add_forge_now/test_views.py          | 203 +++++++++
 swh/web/tests/api/views/test_add_forge_now.py      | 483 +++++++++++++++++++++
 swh/web/tests/conftest.py                          |  12 +-
 swh/web/tests/create_test_admin.py                 |  10 +-
 swh/web/tests/create_test_users.py                 |  23 +-
 .../tests/inbound_email/test_management_command.py | 161 +++++++
 swh/web/tests/inbound_email/test_utils.py          | 113 +++++
 swh/web/tests/test_config.py                       |  23 +
 swh/web/tests/utils.py                             |  14 +-
 swh/web/urls.py                                    |   7 +-
 44 files changed, 2924 insertions(+), 21 deletions(-)
 create mode 100644 assets/src/bundles/add_forge/create-request.js
 create mode 100644 assets/src/bundles/add_forge/index.js
 create mode 100644 assets/src/bundles/add_forge/moderation-dashboard.js
 create mode 100644 cypress/fixtures/add-forge-now-requests.json
 create mode 100644 cypress/integration/add-forge-now-request-create.spec.js
 create mode 100644 cypress/integration/add-forge-now-requests-moderation.spec.js
 create mode 100644 swh/web/add_forge_now/__init__.py
 create mode 100644 swh/web/add_forge_now/apps.py
 create mode 100644 swh/web/add_forge_now/migrations/0001_initial.py
 create mode 100644 swh/web/add_forge_now/migrations/__init__.py
 create mode 100644 swh/web/add_forge_now/models.py
 create mode 100644 swh/web/add_forge_now/tests/test_migration.py
 create mode 100644 swh/web/add_forge_now/views.py
 create mode 100644 swh/web/admin/add_forge_now.py
 create mode 100644 swh/web/api/views/add_forge_now.py
 create mode 100644 swh/web/inbound_email/__init__.py
 create mode 100644 swh/web/inbound_email/apps.py
 create mode 100644 swh/web/inbound_email/management/commands/process_inbound_email.py
 create mode 100644 swh/web/inbound_email/signals.py
 create mode 100644 swh/web/inbound_email/utils.py
 create mode 100644 swh/web/templates/add_forge_now/create-request.html
 create mode 100644 swh/web/templates/add_forge_now/requests-moderation.html
 create mode 100644 swh/web/tests/add_forge_now/test_models.py
 create mode 100644 swh/web/tests/add_forge_now/test_views.py
 create mode 100644 swh/web/tests/api/views/test_add_forge_now.py
 create mode 100644 swh/web/tests/inbound_email/test_management_command.py
 create mode 100644 swh/web/tests/inbound_email/test_utils.py
 create mode 100644 swh/web/tests/test_config.py
Changes applied before test
commit dc215b171708cf98f2f1168eac90e2f9000bf7ef
Merge: 7bfbda85 6ba22d81
Author: Jenkins user <jenkins@localhost>
Date:   Fri Mar 18 11:47:14 2022 +0000

    Merge branch 'diff-target' into HEAD

commit 6ba22d815f159d8cdcdac4008b201abf1350c3a8
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 18 12:42:20 2022 +0100

    Handle error from server during add-forge creation request failure
    
    This is:
    - plainly displaying the text message when a conflict occur.
    - parse the json response otherwise when an input failure occurs.
    
    Related to T4052

commit 2a6c8406c4bfe9bcb2b1c8ca656769b34198c06f
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 18 11:15:51 2022 +0100

    settings.development: Activate add-forge-now feature for development
    
    Related to T4040

commit b30a120340bce5fe9f8ef9f1fabdf73f2d4e9917
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Mar 17 17:41:44 2022 +0100

    Add feature flag to toggle on/off add-forge-now feature
    
    This also prevents the server code from being served when the feature flag is off.
    
    Related to T4040

commit 7e61894e90438f53c625961350d92cd01dc62138
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Mar 17 10:14:51 2022 +0100

    Add moderation view to list add-forge-now requests
    
    In a future commit, it will be possible to browse from that view to the detailed request
    dashboard.
    
    This also reworks the left menu to allow access to staff or people with the add forge
    now moderator permission.
    
    Related to T3991

commit 4e23aa2eb8fca1f5c62a745f44f2f4b3b46003a9
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Mar 17 10:13:22 2022 +0100

    Fix access for people with permission access to deposit moderation
    
    This will allow easier adaptations when adding new views with different permissions.

commit 6c96f964adc7ffb7e9ea32de6d240a6a45bd8b97
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Mar 17 11:33:57 2022 +0100

    Create "Add forge now" request
    
    Added a form to submit an "add forge now" request.
    Left menus changed to include "add forge now" page.
    Possbility to browse existing requests is added
    in a seperate tab in the same view.
    Cypress tests
    
    Related to T3998
    Related to T3989
    Related to T4012
    Related to T3988

commit 80e55b0a12eb27a5df72acf6fe07640db12eaf27
Merge: c24e6822 9f2e1cb9
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 16 16:21:35 2022 +0100

    Merge branch 'master' into sprint-add-forge-now

commit c24e6822a1569817b6d970fbc550cdf66f2188f0
Merge: ca39b06c 627ba79a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 16 14:20:52 2022 +0100

    Merge branch 'master' into sprint-add-forge-now

commit ca39b06c46ba42f73f898377d3093299ea21a85a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 9 16:37:54 2022 +0100

    inbound_email: add utilities to extract and filter email recipients

commit bf099ce9654d0b765f0820189857ab7c7beb6c6b
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 9 14:29:37 2022 +0100

    Bootstrap a common app for management of inbound emails

commit b6d540d2e5fafe04eb71d3b1d8f5c194dafcbb62
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Mar 15 15:06:10 2022 +0100

    add_forge_now: Move datatables listing in dedicated endpoint
    
    Merging datatables special processing in /api/1/add-forge/request/list
    endpoint implementation was quite disturbing.
    
    So better using a dedicated endpoint for that in a similar manner as
    with save code now requests listing.
    
    The endpoint to use with datatables is now the following one:
    /add-forge/request/list/datatables.
    
    Related to T3989
    Related to T3991

commit f6343395310bc226a50a283c88304006e8ece337
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Mon Mar 14 15:35:17 2022 +0100

    api/add_forge_now: Allow to use requests list endpoint with datatables
    
    datatables is the javascript library we use on the frontend side to
    display interactive tables.
    
    As we use server-side processing, table data must be provided in a
    paginated way by an HTTP endpoint.
    
    Response format expected by datatables is different from the one
    returned by the Web API endpoint listing add-forge requests.
    
    So adapt the response format of that endpoint when we know the
    input request has been sent by datatables.
    
    Related to T3989
    Related to T3991

commit 26748e56ecce5877fce3a215eba06a19ebb8342f
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Mar 10 14:09:36 2022 +0100

    api: Add endpoint to get details about an add-forge request
    
    Related to T4030

commit 294a95c711bc40622c6d718afa2535f377b90dfc
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Mar 9 16:30:06 2022 +0100

    api: Add endpoint to list add-forge requests
    
    Related to T4027

commit 1bf17d6a75fd7265b1da9c9e87220efa62869c93
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Mar 9 16:28:03 2022 +0100

    api: Add endpoint to update an add-forge request
    
    Related to T4026

commit 130e9faa9bcab18bc3c76dc898546edb89f3f9b8
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Mar 8 15:23:50 2022 +0100

    api: Add endpoint to create an add-forge request
    
    Related to T3990

commit 03101208803501e5178f35d18d171e740ee4ca76
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Mar 8 11:34:44 2022 +0100

    add_forge_now: Bootstrap app and model

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1496/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1496/console

Harbormaster returned this revision to the author for changes because remote builds failed.Mar 18 2022, 1:05 PM
Harbormaster failed remote builds in B27559: Diff 26679!
vlorentz added inline comments.
assets/src/bundles/add_forge/create-request.js
36–49

No need to have two error messages.

Adapt according to review and fix test

ardumont marked an inline comment as done.
ardumont added inline comments.
assets/src/bundles/add_forge/create-request.js
36–49

Adapted accordingly, i've updated the screenshots (in the diff description) as well.

ardumont added inline comments.
assets/src/bundles/add_forge/create-request.js
46

As another simplification step (for another diff), we'll probably want to massage a bit more the actual api error message case [1] to avoid this convolution ^ [1].

[1] https://forge.softwareheritage.org/source/swh-web/browse/sprint-add-forge-now/swh/web/api/views/add_forge_now.py$131

Build is green

Patch application report for D7378 (id=26695)

Could not rebase; Attempt merge onto 7bfbda85ff...

Merge made by the 'recursive' strategy.
 assets/src/bundles/add_forge/create-request.js     | 113 +++++
 assets/src/bundles/add_forge/index.js              |  11 +
 .../src/bundles/add_forge/moderation-dashboard.js  |  55 +++
 cypress/fixtures/add-forge-now-requests.json       |  79 ++++
 .../add-forge-now-request-create.spec.js           | 139 ++++++
 .../add-forge-now-requests-moderation.spec.js      | 122 ++++++
 cypress/integration/deposit-admin.spec.js          |  52 ++-
 cypress/support/index.js                           |   8 +
 swh/web/add_forge_now/__init__.py                  |   0
 swh/web/add_forge_now/apps.py                      |  10 +
 swh/web/add_forge_now/migrations/0001_initial.py   | 109 +++++
 swh/web/add_forge_now/migrations/__init__.py       |   0
 swh/web/add_forge_now/models.py                    |  99 +++++
 swh/web/add_forge_now/tests/test_migration.py      |  62 +++
 swh/web/add_forge_now/views.py                     | 107 +++++
 swh/web/admin/add_forge_now.py                     |  30 ++
 swh/web/admin/urls.py                              |   6 +-
 swh/web/api/urls.py                                |   1 +
 swh/web/api/views/add_forge_now.py                 | 355 +++++++++++++++
 swh/web/auth/utils.py                              |   1 +
 swh/web/common/utils.py                            |   7 +-
 swh/web/config.py                                  |   9 +
 swh/web/inbound_email/__init__.py                  |   0
 swh/web/inbound_email/apps.py                      |  11 +
 .../management/commands/process_inbound_email.py   |  73 ++++
 swh/web/inbound_email/signals.py                   |  36 ++
 swh/web/inbound_email/utils.py                     |  63 +++
 swh/web/settings/common.py                         |   2 +
 swh/web/settings/development.py                    |   9 +-
 swh/web/settings/tests.py                          |   1 +
 .../templates/add_forge_now/create-request.html    | 234 ++++++++++
 .../add_forge_now/requests-moderation.html         |  45 ++
 swh/web/templates/layout.html                      |  22 +-
 swh/web/tests/add_forge_now/test_models.py         |  26 ++
 swh/web/tests/add_forge_now/test_views.py          | 203 +++++++++
 swh/web/tests/api/views/test_add_forge_now.py      | 483 +++++++++++++++++++++
 swh/web/tests/conftest.py                          |  12 +-
 swh/web/tests/create_test_admin.py                 |  10 +-
 swh/web/tests/create_test_users.py                 |  23 +-
 .../tests/inbound_email/test_management_command.py | 161 +++++++
 swh/web/tests/inbound_email/test_utils.py          | 113 +++++
 swh/web/tests/test_config.py                       |  23 +
 swh/web/tests/utils.py                             |  14 +-
 swh/web/urls.py                                    |   7 +-
 44 files changed, 2925 insertions(+), 21 deletions(-)
 create mode 100644 assets/src/bundles/add_forge/create-request.js
 create mode 100644 assets/src/bundles/add_forge/index.js
 create mode 100644 assets/src/bundles/add_forge/moderation-dashboard.js
 create mode 100644 cypress/fixtures/add-forge-now-requests.json
 create mode 100644 cypress/integration/add-forge-now-request-create.spec.js
 create mode 100644 cypress/integration/add-forge-now-requests-moderation.spec.js
 create mode 100644 swh/web/add_forge_now/__init__.py
 create mode 100644 swh/web/add_forge_now/apps.py
 create mode 100644 swh/web/add_forge_now/migrations/0001_initial.py
 create mode 100644 swh/web/add_forge_now/migrations/__init__.py
 create mode 100644 swh/web/add_forge_now/models.py
 create mode 100644 swh/web/add_forge_now/tests/test_migration.py
 create mode 100644 swh/web/add_forge_now/views.py
 create mode 100644 swh/web/admin/add_forge_now.py
 create mode 100644 swh/web/api/views/add_forge_now.py
 create mode 100644 swh/web/inbound_email/__init__.py
 create mode 100644 swh/web/inbound_email/apps.py
 create mode 100644 swh/web/inbound_email/management/commands/process_inbound_email.py
 create mode 100644 swh/web/inbound_email/signals.py
 create mode 100644 swh/web/inbound_email/utils.py
 create mode 100644 swh/web/templates/add_forge_now/create-request.html
 create mode 100644 swh/web/templates/add_forge_now/requests-moderation.html
 create mode 100644 swh/web/tests/add_forge_now/test_models.py
 create mode 100644 swh/web/tests/add_forge_now/test_views.py
 create mode 100644 swh/web/tests/api/views/test_add_forge_now.py
 create mode 100644 swh/web/tests/inbound_email/test_management_command.py
 create mode 100644 swh/web/tests/inbound_email/test_utils.py
 create mode 100644 swh/web/tests/test_config.py
Changes applied before test
commit d7fb33b4e07dae3dbfac36d4406e9970140630e8
Merge: 7bfbda85 371235c1
Author: Jenkins user <jenkins@localhost>
Date:   Fri Mar 18 13:57:34 2022 +0000

    Merge branch 'diff-target' into HEAD

commit 371235c1b2c83d5508374390165e39e0a694509b
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 18 12:42:20 2022 +0100

    Handle error from server during add-forge creation request failure
    
    This is:
    - plainly displaying the text message when a conflict occur.
    - parse the json response otherwise when an input failure occurs.
    
    Related to T4052

commit 2a6c8406c4bfe9bcb2b1c8ca656769b34198c06f
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 18 11:15:51 2022 +0100

    settings.development: Activate add-forge-now feature for development
    
    Related to T4040

commit b30a120340bce5fe9f8ef9f1fabdf73f2d4e9917
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Mar 17 17:41:44 2022 +0100

    Add feature flag to toggle on/off add-forge-now feature
    
    This also prevents the server code from being served when the feature flag is off.
    
    Related to T4040

commit 7e61894e90438f53c625961350d92cd01dc62138
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Mar 17 10:14:51 2022 +0100

    Add moderation view to list add-forge-now requests
    
    In a future commit, it will be possible to browse from that view to the detailed request
    dashboard.
    
    This also reworks the left menu to allow access to staff or people with the add forge
    now moderator permission.
    
    Related to T3991

commit 4e23aa2eb8fca1f5c62a745f44f2f4b3b46003a9
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Mar 17 10:13:22 2022 +0100

    Fix access for people with permission access to deposit moderation
    
    This will allow easier adaptations when adding new views with different permissions.

commit 6c96f964adc7ffb7e9ea32de6d240a6a45bd8b97
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Mar 17 11:33:57 2022 +0100

    Create "Add forge now" request
    
    Added a form to submit an "add forge now" request.
    Left menus changed to include "add forge now" page.
    Possbility to browse existing requests is added
    in a seperate tab in the same view.
    Cypress tests
    
    Related to T3998
    Related to T3989
    Related to T4012
    Related to T3988

commit 80e55b0a12eb27a5df72acf6fe07640db12eaf27
Merge: c24e6822 9f2e1cb9
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 16 16:21:35 2022 +0100

    Merge branch 'master' into sprint-add-forge-now

commit c24e6822a1569817b6d970fbc550cdf66f2188f0
Merge: ca39b06c 627ba79a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 16 14:20:52 2022 +0100

    Merge branch 'master' into sprint-add-forge-now

commit ca39b06c46ba42f73f898377d3093299ea21a85a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 9 16:37:54 2022 +0100

    inbound_email: add utilities to extract and filter email recipients

commit bf099ce9654d0b765f0820189857ab7c7beb6c6b
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 9 14:29:37 2022 +0100

    Bootstrap a common app for management of inbound emails

commit b6d540d2e5fafe04eb71d3b1d8f5c194dafcbb62
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Mar 15 15:06:10 2022 +0100

    add_forge_now: Move datatables listing in dedicated endpoint
    
    Merging datatables special processing in /api/1/add-forge/request/list
    endpoint implementation was quite disturbing.
    
    So better using a dedicated endpoint for that in a similar manner as
    with save code now requests listing.
    
    The endpoint to use with datatables is now the following one:
    /add-forge/request/list/datatables.
    
    Related to T3989
    Related to T3991

commit f6343395310bc226a50a283c88304006e8ece337
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Mon Mar 14 15:35:17 2022 +0100

    api/add_forge_now: Allow to use requests list endpoint with datatables
    
    datatables is the javascript library we use on the frontend side to
    display interactive tables.
    
    As we use server-side processing, table data must be provided in a
    paginated way by an HTTP endpoint.
    
    Response format expected by datatables is different from the one
    returned by the Web API endpoint listing add-forge requests.
    
    So adapt the response format of that endpoint when we know the
    input request has been sent by datatables.
    
    Related to T3989
    Related to T3991

commit 26748e56ecce5877fce3a215eba06a19ebb8342f
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Mar 10 14:09:36 2022 +0100

    api: Add endpoint to get details about an add-forge request
    
    Related to T4030

commit 294a95c711bc40622c6d718afa2535f377b90dfc
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Mar 9 16:30:06 2022 +0100

    api: Add endpoint to list add-forge requests
    
    Related to T4027

commit 1bf17d6a75fd7265b1da9c9e87220efa62869c93
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Mar 9 16:28:03 2022 +0100

    api: Add endpoint to update an add-forge request
    
    Related to T4026

commit 130e9faa9bcab18bc3c76dc898546edb89f3f9b8
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Mar 8 15:23:50 2022 +0100

    api: Add endpoint to create an add-forge request
    
    Related to T3990

commit 03101208803501e5178f35d18d171e740ee4ca76
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Mar 8 11:34:44 2022 +0100

    add_forge_now: Bootstrap app and model

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1500/ for more details.

assets/src/bundles/add_forge/create-request.js
46

missing coverage: i've got a stashed failed attempd for that in a stash... [1]
i don't understand why the intercept creation query url does not actually intercept it...
The submission succeeds ¯\_(ツ)_/¯ while i want it to fail.

[1] P1314

anlambert added a subscriber: anlambert.
anlambert added inline comments.
assets/src/bundles/add_forge/create-request.js
46

You need to indicate it is a POST request in the intercept:

cy.intercept('POST', `${this.Urls.api_1_add_forge_request_create()}**`,
	                 {fixture: 'add-forge-now-create-request-fail'}).as('errorRequest');
This revision is now accepted and ready to land.Mar 18 2022, 3:16 PM
swh/web/settings/development.py
17–20 ↗(On Diff #26695)

maybe we could set the feature to True in default config instead ?

assets/src/bundles/add_forge/create-request.js
46

do'h right, thx.

swh/web/settings/development.py
17–20 ↗(On Diff #26695)

ah yeah, now that we explicitely set it to false in the puppet part...
(well, i've landed it in the branch now so later ;)

Build is green

Patch application report for D7378 (id=26698)

Could not rebase; Attempt merge onto 7bfbda85ff...

Merge made by the 'recursive' strategy.
 .../bundles/add_forge/add-request-history-item.ejs |  30 ++
 assets/src/bundles/add_forge/create-request.js     | 113 +++++
 assets/src/bundles/add_forge/forge-admin-email.ejs |  28 ++
 assets/src/bundles/add_forge/index.js              |  12 +
 .../src/bundles/add_forge/moderation-dashboard.js  |  58 +++
 assets/src/bundles/add_forge/request-dashboard.js  | 135 ++++++
 cypress/fixtures/add-forge-now-request.json        |  23 +
 cypress/fixtures/add-forge-now-requests.json       |  79 ++++
 .../add-forge-now-request-create.spec.js           | 139 ++++++
 .../add-forge-now-request-dashboard.spec.js        |  68 +++
 .../add-forge-now-requests-moderation.spec.js      | 122 ++++++
 cypress/integration/deposit-admin.spec.js          |  52 ++-
 cypress/support/index.js                           |   8 +
 swh/web/add_forge_now/__init__.py                  |   0
 swh/web/add_forge_now/apps.py                      |  10 +
 swh/web/add_forge_now/migrations/0001_initial.py   | 109 +++++
 swh/web/add_forge_now/migrations/__init__.py       |   0
 swh/web/add_forge_now/models.py                    |  99 +++++
 swh/web/add_forge_now/tests/test_migration.py      |  62 +++
 swh/web/add_forge_now/views.py                     | 107 +++++
 swh/web/admin/add_forge_now.py                     |  46 ++
 swh/web/admin/urls.py                              |   6 +-
 swh/web/api/urls.py                                |   1 +
 swh/web/api/views/add_forge_now.py                 | 355 +++++++++++++++
 swh/web/auth/utils.py                              |   1 +
 swh/web/common/utils.py                            |   7 +-
 swh/web/config.py                                  |   9 +
 swh/web/inbound_email/__init__.py                  |   0
 swh/web/inbound_email/apps.py                      |  11 +
 .../management/commands/process_inbound_email.py   |  73 ++++
 swh/web/inbound_email/signals.py                   |  36 ++
 swh/web/inbound_email/utils.py                     |  63 +++
 swh/web/settings/common.py                         |   2 +
 swh/web/settings/development.py                    |   9 +-
 swh/web/settings/tests.py                          |   1 +
 .../templates/add_forge_now/create-request.html    | 234 ++++++++++
 .../templates/add_forge_now/request-dashboard.html | 135 ++++++
 .../add_forge_now/requests-moderation.html         |  45 ++
 swh/web/templates/layout.html                      |  22 +-
 swh/web/tests/add_forge_now/test_models.py         |  26 ++
 swh/web/tests/add_forge_now/test_views.py          | 203 +++++++++
 swh/web/tests/api/views/test_add_forge_now.py      | 483 +++++++++++++++++++++
 swh/web/tests/conftest.py                          |  12 +-
 swh/web/tests/create_test_admin.py                 |  10 +-
 swh/web/tests/create_test_users.py                 |  23 +-
 .../tests/inbound_email/test_management_command.py | 161 +++++++
 swh/web/tests/inbound_email/test_utils.py          | 113 +++++
 swh/web/tests/test_config.py                       |  23 +
 swh/web/tests/utils.py                             |  14 +-
 swh/web/urls.py                                    |   7 +-
 50 files changed, 3364 insertions(+), 21 deletions(-)
 create mode 100644 assets/src/bundles/add_forge/add-request-history-item.ejs
 create mode 100644 assets/src/bundles/add_forge/create-request.js
 create mode 100644 assets/src/bundles/add_forge/forge-admin-email.ejs
 create mode 100644 assets/src/bundles/add_forge/index.js
 create mode 100644 assets/src/bundles/add_forge/moderation-dashboard.js
 create mode 100644 assets/src/bundles/add_forge/request-dashboard.js
 create mode 100644 cypress/fixtures/add-forge-now-request.json
 create mode 100644 cypress/fixtures/add-forge-now-requests.json
 create mode 100644 cypress/integration/add-forge-now-request-create.spec.js
 create mode 100644 cypress/integration/add-forge-now-request-dashboard.spec.js
 create mode 100644 cypress/integration/add-forge-now-requests-moderation.spec.js
 create mode 100644 swh/web/add_forge_now/__init__.py
 create mode 100644 swh/web/add_forge_now/apps.py
 create mode 100644 swh/web/add_forge_now/migrations/0001_initial.py
 create mode 100644 swh/web/add_forge_now/migrations/__init__.py
 create mode 100644 swh/web/add_forge_now/models.py
 create mode 100644 swh/web/add_forge_now/tests/test_migration.py
 create mode 100644 swh/web/add_forge_now/views.py
 create mode 100644 swh/web/admin/add_forge_now.py
 create mode 100644 swh/web/api/views/add_forge_now.py
 create mode 100644 swh/web/inbound_email/__init__.py
 create mode 100644 swh/web/inbound_email/apps.py
 create mode 100644 swh/web/inbound_email/management/commands/process_inbound_email.py
 create mode 100644 swh/web/inbound_email/signals.py
 create mode 100644 swh/web/inbound_email/utils.py
 create mode 100644 swh/web/templates/add_forge_now/create-request.html
 create mode 100644 swh/web/templates/add_forge_now/request-dashboard.html
 create mode 100644 swh/web/templates/add_forge_now/requests-moderation.html
 create mode 100644 swh/web/tests/add_forge_now/test_models.py
 create mode 100644 swh/web/tests/add_forge_now/test_views.py
 create mode 100644 swh/web/tests/api/views/test_add_forge_now.py
 create mode 100644 swh/web/tests/inbound_email/test_management_command.py
 create mode 100644 swh/web/tests/inbound_email/test_utils.py
 create mode 100644 swh/web/tests/test_config.py
Changes applied before test
commit d1a0cf1409bb9c21b05a745d9d73796d6e13befb
Merge: 7bfbda85 56f007d8
Author: Jenkins user <jenkins@localhost>
Date:   Fri Mar 18 14:32:12 2022 +0000

    Merge branch 'diff-target' into HEAD

commit 56f007d863c31988f904ab82293dea1a508efc86
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 18 12:42:20 2022 +0100

    Handle error from server during add-forge creation request failure
    
    This is:
    - plainly displaying the text message when a conflict occur.
    - parse the json response otherwise when an input failure occurs.
    
    Related to T4052

commit 2c3dedaf6f65e3e31fd4fa8cfe23c037b8dee4d8
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 18 11:15:51 2022 +0100

    settings.development: Activate add-forge-now feature for development
    
    Related to T4040

commit 0a796988974ed60d674262adb30ed322bbc27a8c
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Fri Mar 18 14:20:44 2022 +0100

    Add-forge-now request dashboard
    
    To be used by moderators to update the status of a request
    Shows details about a request and its history
    Cypress tests
    
    Related to T3992
    Related to T4003
    Related to T4001

commit b30a120340bce5fe9f8ef9f1fabdf73f2d4e9917
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Mar 17 17:41:44 2022 +0100

    Add feature flag to toggle on/off add-forge-now feature
    
    This also prevents the server code from being served when the feature flag is off.
    
    Related to T4040

commit 7e61894e90438f53c625961350d92cd01dc62138
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Mar 17 10:14:51 2022 +0100

    Add moderation view to list add-forge-now requests
    
    In a future commit, it will be possible to browse from that view to the detailed request
    dashboard.
    
    This also reworks the left menu to allow access to staff or people with the add forge
    now moderator permission.
    
    Related to T3991

commit 4e23aa2eb8fca1f5c62a745f44f2f4b3b46003a9
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Thu Mar 17 10:13:22 2022 +0100

    Fix access for people with permission access to deposit moderation
    
    This will allow easier adaptations when adding new views with different permissions.

commit 6c96f964adc7ffb7e9ea32de6d240a6a45bd8b97
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Mar 17 11:33:57 2022 +0100

    Create "Add forge now" request
    
    Added a form to submit an "add forge now" request.
    Left menus changed to include "add forge now" page.
    Possbility to browse existing requests is added
    in a seperate tab in the same view.
    Cypress tests
    
    Related to T3998
    Related to T3989
    Related to T4012
    Related to T3988

commit 80e55b0a12eb27a5df72acf6fe07640db12eaf27
Merge: c24e6822 9f2e1cb9
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 16 16:21:35 2022 +0100

    Merge branch 'master' into sprint-add-forge-now

commit c24e6822a1569817b6d970fbc550cdf66f2188f0
Merge: ca39b06c 627ba79a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 16 14:20:52 2022 +0100

    Merge branch 'master' into sprint-add-forge-now

commit ca39b06c46ba42f73f898377d3093299ea21a85a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 9 16:37:54 2022 +0100

    inbound_email: add utilities to extract and filter email recipients

commit bf099ce9654d0b765f0820189857ab7c7beb6c6b
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Mar 9 14:29:37 2022 +0100

    Bootstrap a common app for management of inbound emails

commit b6d540d2e5fafe04eb71d3b1d8f5c194dafcbb62
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Mar 15 15:06:10 2022 +0100

    add_forge_now: Move datatables listing in dedicated endpoint
    
    Merging datatables special processing in /api/1/add-forge/request/list
    endpoint implementation was quite disturbing.
    
    So better using a dedicated endpoint for that in a similar manner as
    with save code now requests listing.
    
    The endpoint to use with datatables is now the following one:
    /add-forge/request/list/datatables.
    
    Related to T3989
    Related to T3991

commit f6343395310bc226a50a283c88304006e8ece337
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Mon Mar 14 15:35:17 2022 +0100

    api/add_forge_now: Allow to use requests list endpoint with datatables
    
    datatables is the javascript library we use on the frontend side to
    display interactive tables.
    
    As we use server-side processing, table data must be provided in a
    paginated way by an HTTP endpoint.
    
    Response format expected by datatables is different from the one
    returned by the Web API endpoint listing add-forge requests.
    
    So adapt the response format of that endpoint when we know the
    input request has been sent by datatables.
    
    Related to T3989
    Related to T3991

commit 26748e56ecce5877fce3a215eba06a19ebb8342f
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Mar 10 14:09:36 2022 +0100

    api: Add endpoint to get details about an add-forge request
    
    Related to T4030

commit 294a95c711bc40622c6d718afa2535f377b90dfc
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Mar 9 16:30:06 2022 +0100

    api: Add endpoint to list add-forge requests
    
    Related to T4027

commit 1bf17d6a75fd7265b1da9c9e87220efa62869c93
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Wed Mar 9 16:28:03 2022 +0100

    api: Add endpoint to update an add-forge request
    
    Related to T4026

commit 130e9faa9bcab18bc3c76dc898546edb89f3f9b8
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Mar 8 15:23:50 2022 +0100

    api: Add endpoint to create an add-forge request
    
    Related to T3990

commit 03101208803501e5178f35d18d171e740ee4ca76
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Tue Mar 8 11:34:44 2022 +0100

    add_forge_now: Bootstrap app and model

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1502/ for more details.

ardumont edited the summary of this revision. (Show Details)
  • Add missing scenario
  • Rebase on latest master

Build is green

Patch application report for D7378 (id=26715)

Rebasing onto 8e11938147...

Current branch diff-target is up to date.
Changes applied before test
commit f937632950121e44d8a0cbb308abb444eb617dde
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 18 12:42:20 2022 +0100

    Handle error from server during add-forge creation request failure
    
    This is:
    - plainly displaying the text message when a conflict occur.
    - parse the json response otherwise when an input failure occurs.
    - if the json response parsing fails too, the raw json is displayed as fallback
    
    Related to T4052

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1505/ for more details.