decidim 0.31.5 → 0.32.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/decidim-core/lib/decidim/shakapacker/runner.rb +4 -4
  3. data/decidim-core/lib/decidim/shakapacker/shakapacker.yml +28 -3
  4. data/decidim.gemspec +21 -24
  5. data/docs/antora.yml +1 -1
  6. data/docs/modules/configure/pages/environment_variables.adoc +4 -26
  7. data/docs/modules/customize/pages/logic.adoc +31 -0
  8. data/docs/modules/develop/assets/images/maintainers-backports-checker.png +0 -0
  9. data/docs/modules/develop/pages/api/authentication.adoc +95 -0
  10. data/docs/modules/develop/pages/api/core-concepts.adoc +535 -0
  11. data/docs/modules/develop/pages/api/index.adoc +83 -0
  12. data/docs/modules/develop/pages/api/reference/components/debates/close.adoc +48 -0
  13. data/docs/modules/develop/pages/api/reference/components/debates/create.adoc +58 -0
  14. data/docs/modules/develop/pages/api/reference/components/debates/update.adoc +63 -0
  15. data/docs/modules/develop/pages/api/reference/components/debates.adoc +9 -0
  16. data/docs/modules/develop/pages/api/reference/components/meetings/close.adoc +48 -0
  17. data/docs/modules/develop/pages/api/reference/components/meetings/create.adoc +108 -0
  18. data/docs/modules/develop/pages/api/reference/components/meetings/update.adoc +95 -0
  19. data/docs/modules/develop/pages/api/reference/components/meetings/withdraw.adoc +36 -0
  20. data/docs/modules/develop/pages/api/reference/components/meetings.adoc +10 -0
  21. data/docs/modules/develop/pages/api/reference/components/proposals/answer.adoc +82 -0
  22. data/docs/modules/develop/pages/api/reference/components/proposals/create.adoc +78 -0
  23. data/docs/modules/develop/pages/api/reference/components/proposals/update.adoc +66 -0
  24. data/docs/modules/develop/pages/api/reference/components/proposals/vote.adoc +73 -0
  25. data/docs/modules/develop/pages/api/reference/components/proposals/withdraw.adoc +38 -0
  26. data/docs/modules/develop/pages/api/reference/components/proposals.adoc +14 -0
  27. data/docs/modules/develop/pages/api/reference/errors/attribute_validation_error.adoc +38 -0
  28. data/docs/modules/develop/pages/api/reference/errors/introspection_disabled_error.adoc +19 -0
  29. data/docs/modules/develop/pages/api/reference/errors/invalid_locale_error.adoc +30 -0
  30. data/docs/modules/develop/pages/api/reference/errors/locale_error.adoc +30 -0
  31. data/docs/modules/develop/pages/api/reference/errors/not_found.adoc +30 -0
  32. data/docs/modules/develop/pages/api/reference/errors/permission_not_set.adoc +46 -0
  33. data/docs/modules/develop/pages/api/reference/errors/recursion_limit_exceeded_error.adoc +19 -0
  34. data/docs/modules/develop/pages/api/reference/errors/too_many_aliases_error.adoc +23 -0
  35. data/docs/modules/develop/pages/api/reference/errors/unauthorized_field.adoc +30 -0
  36. data/docs/modules/develop/pages/api/reference/errors/unauthorized_mutation.adoc +30 -0
  37. data/docs/modules/develop/pages/api/reference/errors/unauthorized_object.adoc +30 -0
  38. data/docs/modules/develop/pages/api/reference/errors/validation_error.adoc +30 -0
  39. data/docs/modules/develop/pages/api/reference/errors.adoc +29 -0
  40. data/docs/modules/develop/pages/backports.adoc +100 -19
  41. data/docs/modules/develop/pages/c4_component.adoc +0 -3
  42. data/docs/modules/develop/pages/classes/models.adoc +0 -1
  43. data/docs/modules/develop/pages/components.adoc +67 -1
  44. data/docs/modules/develop/pages/machine_translations.adoc +1 -1
  45. data/docs/modules/develop/pages/maintainers/releases.adoc +34 -21
  46. data/docs/modules/develop/pages/maintainers/security.adoc +15 -1
  47. data/docs/modules/develop/partials/api/decidim_version.adoc +102 -0
  48. data/docs/modules/install/pages/manual.adoc +4 -3
  49. data/docs/modules/install/pages/update.adoc +7 -24
  50. data/docs/modules/install/partials/version_matrix.adoc +4 -8
  51. data/docs/modules/services/pages/activestorage.adoc +40 -0
  52. data/docs/modules/services/pages/aitools.adoc +0 -1
  53. data/docs/modules/services/pages/index.adoc +1 -0
  54. data/docs/modules/services/pages/machine_translation.adoc +139 -2
  55. data/docs/modules/services/pages/maps.adoc +42 -0
  56. data/lib/decidim/gem_manager.rb +16 -2
  57. data/lib/decidim/version.rb +1 -1
  58. data/lib/decidim.rb +0 -1
  59. data/package-lock.json +21945 -12726
  60. data/package.json +5 -4
  61. data/packages/browserslist-config/package.json +1 -1
  62. data/packages/core/package.json +28 -28
  63. data/packages/dev/package.json +2 -2
  64. data/packages/eslint-config/package.json +1 -1
  65. data/packages/prettier-config/package.json +1 -1
  66. data/packages/stylelint-config/package.json +1 -1
  67. data/packages/webpacker/package.json +12 -12
  68. data/packages/webpacker/src/override-config.js +1 -1
  69. metadata +73 -58
  70. data/docs/modules/develop/pages/api.adoc +0 -21
@@ -0,0 +1,73 @@
1
+ = Vote / Unvote Proposal
2
+
3
+ == Vote Proposal
4
+
5
+ To use the API to vote any proposal that is configured to receive votes, you will need to use the following API request.
6
+
7
+ [source,graphql]
8
+ ----
9
+ mutation voteProposal($componentId: ID!, $proposalId: ID!){
10
+ component(id: $componentId) {
11
+ ...on ProposalsMutation{
12
+ proposal(id: $proposalId) {
13
+ vote(input: {}) {
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
19
+ ----
20
+
21
+ Example of submitted variables
22
+
23
+ [source,json]
24
+ ----
25
+ {
26
+ "componentId": "9",
27
+ "proposalId": "2"
28
+ }
29
+ ----
30
+
31
+ === Error Handling
32
+
33
+ The most frequent errors that can be generated by this mutation are as follows:
34
+
35
+ * xref:develop:api/reference/errors/unauthorized_mutation.adoc[Unauthorized Mutation Error - MUTATION_NOT_AUTHORIZED_ERROR]
36
+ * xref:develop:api/reference/errors/validation_error.adoc[Validation Error - VALIDATION_ERROR]
37
+ * xref:develop:api/reference/errors/unauthorized_object.adoc[Unauthorized Object Error - UNAUTHORIZED_OBJECT_ERROR]
38
+
39
+ == Unvote Proposal
40
+
41
+ To use the API to remove a vote on any proposal that you have already voted, you will need to use the following API request.
42
+
43
+ [source,graphql]
44
+ ----
45
+ mutation unvoteProposal($componentId: ID!, $proposalId: ID!){
46
+ component(id: $componentId) {
47
+ ...on ProposalsMutation{
48
+ proposal(id: $proposalId) {
49
+ unvote(input: {}) {
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ ----
56
+
57
+ Example of submitted variables
58
+
59
+ [source,json]
60
+ ----
61
+ {
62
+ "componentId": "9",
63
+ "proposalId": "2"
64
+ }
65
+ ----
66
+
67
+ === Error Handling
68
+
69
+ The most frequent errors that can be generated by this mutation are as follows:
70
+
71
+ * xref:develop:api/reference/errors/unauthorized_mutation.adoc[Unauthorized Mutation Error - MUTATION_NOT_AUTHORIZED_ERROR]
72
+ * xref:develop:api/reference/errors/validation_error.adoc[Validation Error - VALIDATION_ERROR]
73
+ * xref:develop:api/reference/errors/unauthorized_object.adoc[Unauthorized Object Error - UNAUTHORIZED_OBJECT_ERROR]
@@ -0,0 +1,38 @@
1
+ = Withdraw Proposal
2
+
3
+ To use the API to withdraw any proposal that the user has created, you will need to use the following API request.
4
+
5
+ [source,graphql]
6
+ ----
7
+ mutation withdrawProposal($componentId: ID!, $proposalId: ID!){
8
+ component(id: $componentId) {
9
+ ...on ProposalsMutation{
10
+ proposal(id: $proposalId) {
11
+ withdraw(input: {}) {
12
+ id
13
+ state
14
+ withdrawnAt
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
20
+ ----
21
+
22
+ Example of submitted variables
23
+
24
+ [source,json]
25
+ ----
26
+ {
27
+ "componentId": "9",
28
+ "proposalId": "2"
29
+ }
30
+ ----
31
+
32
+ == Error Handling
33
+
34
+ The most frequent errors that can be generated by this mutation are as follows:
35
+
36
+ * xref:develop:api/reference/errors/unauthorized_mutation.adoc[Unauthorized Mutation Error - MUTATION_NOT_AUTHORIZED_ERROR]
37
+ * xref:develop:api/reference/errors/validation_error.adoc[Validation Error - VALIDATION_ERROR]
38
+ * xref:develop:api/reference/errors/unauthorized_object.adoc[Unauthorized Object Error - UNAUTHORIZED_OBJECT_ERROR]
@@ -0,0 +1,14 @@
1
+ = Proposals
2
+
3
+ In the proposals module we are providing a few mutations that we find useful for day-to-day management of Decidim instance outside the admin.
4
+
5
+ == For user/participants roles
6
+
7
+ * xref:develop:api/reference/components/proposals/create.adoc[Create Proposal]
8
+ * xref:develop:api/reference/components/proposals/update.adoc[Update Proposal]
9
+ * xref:develop:api/reference/components/proposals/withdraw.adoc[Withdraw Proposal]
10
+ * xref:develop:api/reference/components/proposals/vote.adoc[Vote Proposal]
11
+
12
+ == For admin roles
13
+
14
+ * xref:develop:api/reference/components/proposals/answer.adoc[Answer Proposal]
@@ -0,0 +1,38 @@
1
+ = Attribute Validation Error - ATTRIBUTE_VALIDATION_ERROR
2
+
3
+ This error is triggered when a user submits invalid data into a mutation form. This error is the equivalent of the form validation errors seen in the HTTP version
4
+
5
+ The JSON response structure is:
6
+ [source, json]
7
+ ----
8
+ {
9
+ "errors": [
10
+ {
11
+ "message": [
12
+ {
13
+ "path": ["attributes", "title"],
14
+ "message": "cannot be blank"
15
+ },
16
+ {
17
+ "path": ["attributes", "title"],
18
+ "message": "is too short (under 15 characters)"}
19
+ ],
20
+ "locations": [
21
+ {
22
+ "line": 2,
23
+ "column": 3
24
+ }
25
+ ],
26
+ "path": [
27
+ "createProposal"
28
+ ],
29
+ "extensions": {
30
+ "code": "ATTRIBUTE_VALIDATION_ERROR"
31
+ }
32
+ }
33
+ ],
34
+ "data": {
35
+ "createProposal": null
36
+ }
37
+ }
38
+ ----
@@ -0,0 +1,19 @@
1
+ = Introspection disabled error - INTROSPECTION_DISABLED_ERROR
2
+
3
+ This error is triggered when a user tries to run introspections, and they do not have the required permissions. By default, Decidim API allows administrators to run introspection queries but restricts them for regular users due to security concerns.
4
+
5
+ The JSON response structure is:
6
+
7
+ [source, json]
8
+ ----
9
+ {
10
+ "errors": [
11
+ {
12
+ "message": "Introspection is disabled for this request",
13
+ "extensions": {
14
+ "code": "INTROSPECTION_DISABLED_ERROR"
15
+ }
16
+ }
17
+ ]
18
+ }
19
+ ----
@@ -0,0 +1,30 @@
1
+ = Invalid Locale Error - INVALID_LOCALE_ERROR
2
+
3
+ This error is issued when the user submits or requests content in a language that is not supported by the platform.
4
+
5
+ The JSON response structure is:
6
+ [source, json]
7
+ ----
8
+ {
9
+ "errors": [
10
+ {
11
+ "message": "Invalid locale provided",
12
+ "locations": [
13
+ {
14
+ "line": 2,
15
+ "column": 3
16
+ }
17
+ ],
18
+ "path": [
19
+ "createProposal"
20
+ ],
21
+ "extensions": {
22
+ "code": "INVALID_LOCALE_ERROR"
23
+ }
24
+ }
25
+ ],
26
+ "data": {
27
+ "createProposal": null
28
+ }
29
+ }
30
+ ----
@@ -0,0 +1,30 @@
1
+ = Locale Error - LOCALE_ERROR
2
+
3
+ This error is triggered when the requested language has any internationalization errors, like missing translation string, bad variable replacement (interpolation), or any other I18n errors.
4
+
5
+ The JSON response structure is:
6
+ [source, json]
7
+ ----
8
+ {
9
+ "errors": [
10
+ {
11
+ "message": "There was an error while internally handling i18n data",
12
+ "locations": [
13
+ {
14
+ "line": 2,
15
+ "column": 39
16
+ }
17
+ ],
18
+ "path": [
19
+ "createProposal"
20
+ ],
21
+ "extensions": {
22
+ "code": "LOCALE_ERROR"
23
+ }
24
+ }
25
+ ],
26
+ "data": {
27
+ "createProposal": null
28
+ }
29
+ }
30
+ ----
@@ -0,0 +1,30 @@
1
+ = Not Found Error - NOT_FOUND_ERROR
2
+
3
+ This error is triggered when the requested record does not exist in the database, or is in a state where you should not have access to it (moderated, belongs to an unpublished component, belongs to a private process where the requesting user does not have access). This is equivalent to 404 HTTP Status code.
4
+
5
+ The JSON response structure is:
6
+ [source, json]
7
+ ----
8
+ {
9
+ "errors": [
10
+ {
11
+ "message": "ParticipatoryProcess not found",
12
+ "extensions": {
13
+ "code": "NOT_FOUND_ERROR"
14
+ },
15
+ "locations": [
16
+ {
17
+ "line": 2,
18
+ "column": 3
19
+ }
20
+ ],
21
+ "path": [
22
+ "participatoryProcess"
23
+ ]
24
+ }
25
+ ],
26
+ "data": {
27
+ "participatoryProcess": null
28
+ }
29
+ }
30
+ ----
@@ -0,0 +1,46 @@
1
+ = Permission Not Set Error - PERMISSION_NOT_SET_ERROR
2
+
3
+ This is an error that should not be seen by end users, as this error is being fired when a request passes through a managed permission handler.
4
+
5
+ The JSON response structure is:
6
+ [source, json]
7
+ ----
8
+ {
9
+ "errors": [
10
+ {
11
+ "message": "Permission has not been set for this Project",
12
+ "locations": [
13
+ {
14
+ "line": 3,
15
+ "column": 5
16
+ }
17
+ ],
18
+ "path": [
19
+ "participatoryProcess",
20
+ "components",
21
+ 0,
22
+ "budget",
23
+ "projects",
24
+ 0
25
+ ],
26
+ "extensions": {
27
+ "code": "PERMISSION_NOT_SET_ERROR"
28
+ }
29
+ }
30
+ ],
31
+ "data": {
32
+ "participatoryProcess": {
33
+ "components": [
34
+ {
35
+ "id": "3",
36
+ "budget": {
37
+ "projects": [
38
+ null
39
+ ]
40
+ }
41
+ }
42
+ ]
43
+ }
44
+ }
45
+ }
46
+ ----
@@ -0,0 +1,19 @@
1
+ = Recursion limit error - RECURSION_LIMIT_EXCEEDED_ERROR
2
+
3
+ This error is triggered when your query uses a GraphQL circular reference for more than two times. By default, Decidim API restricts the circular reference calls due to security and performance issues.
4
+
5
+ The JSON response structure is:
6
+
7
+ [source, json]
8
+ ----
9
+ {
10
+ "errors": [
11
+ {
12
+ "message": "Too many recursions detected in query",
13
+ "extensions": {
14
+ "code": "RECURSION_LIMIT_EXCEEDED_ERROR"
15
+ }
16
+ }
17
+ ]
18
+ }
19
+ ----
@@ -0,0 +1,23 @@
1
+ = Too many Aliases error - TOO_MANY_ALIASES_ERROR
2
+
3
+ This error is triggered when your query has too many aliases.
4
+ To avoid this, you should do any of the following:
5
+
6
+ - Simplify the query
7
+ - If you are unable, ask for the implementer of the instance to change the `API_SCHEMA_MAX_ALIASES` environment variable. (xref:configure:environment_variables.adoc[Environment Variables page])
8
+
9
+ The JSON response structure is:
10
+
11
+ [source, json]
12
+ ----
13
+ {
14
+ "errors": [
15
+ {
16
+ "message": "Too many aliases used. You have used 51 aliases, but 5 are allowed.",
17
+ "extensions": {
18
+ "code": "TOO_MANY_ALIASES_ERROR"
19
+ }
20
+ }
21
+ ]
22
+ }
23
+ ----
@@ -0,0 +1,30 @@
1
+ = Unauthorized Field Error - UNAUTHORIZED_FIELD_ERROR
2
+
3
+ This error is triggered when the requesting user does not have access to a certain field, or a certain resource.
4
+
5
+ The JSON response structure is:
6
+ [source, json]
7
+ ----
8
+ {
9
+ "errors": [
10
+ {
11
+ "message": "You cannot view or edit answer field on Answer because you do not have permission",
12
+ "locations": [
13
+ {
14
+ "line": 2,
15
+ "column": 3
16
+ }
17
+ ],
18
+ "path": [
19
+ "answer"
20
+ ],
21
+ "extensions": {
22
+ "code": "UNAUTHORIZED_FIELD_ERROR"
23
+ }
24
+ }
25
+ ],
26
+ "data": {
27
+ "answer": null
28
+ }
29
+ }
30
+ ----
@@ -0,0 +1,30 @@
1
+ = Unauthorized Mutation Error - MUTATION_NOT_AUTHORIZED_ERROR
2
+
3
+ This error is triggered when a user submits a mutation request to a resource they do not have access to.
4
+
5
+ The JSON response structure is:
6
+ [source, json]
7
+ ----
8
+ {
9
+ "errors": [
10
+ {
11
+ "message": "You do not have permission to perform this mutation",
12
+ "locations": [
13
+ {
14
+ "line": 2,
15
+ "column": 3
16
+ }
17
+ ],
18
+ "path": [
19
+ "createProposal"
20
+ ],
21
+ "extensions": {
22
+ "code": "MUTATION_NOT_AUTHORIZED_ERROR"
23
+ }
24
+ }
25
+ ],
26
+ "data": {
27
+ "createProposal": null
28
+ }
29
+ }
30
+ ----
@@ -0,0 +1,30 @@
1
+ = Unauthorized Object Error - UNAUTHORIZED_OBJECT_ERROR
2
+
3
+ This error is triggered when the requesting user does not have access to a certain resource.
4
+
5
+ The JSON response structure is:
6
+ [source, json]
7
+ ----
8
+ {
9
+ "errors": [
10
+ {
11
+ "message": "You cannot view or edit this Result because you do not have permissions",
12
+ "locations": [
13
+ {
14
+ "line": 2,
15
+ "column": 3
16
+ }
17
+ ],
18
+ "path": [
19
+ "vote"
20
+ ],
21
+ "extensions": {
22
+ "code": "UNAUTHORIZED_OBJECT_ERROR"
23
+ }
24
+ }
25
+ ],
26
+ "data": {
27
+ "result": null
28
+ }
29
+ }
30
+ ----
@@ -0,0 +1,30 @@
1
+ = Validation Error - VALIDATION_ERROR
2
+
3
+ This error is triggered when the requesting user performs an action that contains an error, for example, when the user tries to publish a resource that is already published. This is equivalent to the flash messages displayed on the Website.
4
+
5
+ The JSON response structure is:
6
+ [source, json]
7
+ ----
8
+ {
9
+ "errors": [
10
+ {
11
+ "message": "There was a problem voting the proposal.",
12
+ "locations": [
13
+ {
14
+ "line": 2,
15
+ "column": 3
16
+ }
17
+ ],
18
+ "path": [
19
+ "vote"
20
+ ],
21
+ "extensions": {
22
+ "code": "VALIDATION_ERROR"
23
+ }
24
+ }
25
+ ],
26
+ "data": {
27
+ "vote": null
28
+ }
29
+ }
30
+ ----
@@ -0,0 +1,29 @@
1
+ = Error Handling for the API
2
+
3
+ Currently, in Decidim we are using some exceptions to handle API responses, aiming to serve both input (receiving data through API) and output (sending data through API).
4
+
5
+ At the moment there are 4 categories of exceptions that are being handled:
6
+
7
+ == System Errors
8
+
9
+ * xref:develop:api/reference/errors/too_many_aliases_error.adoc[Too many aliases error - TOO_MANY_ALIASES_ERROR] - is triggered when your query uses too many aliases.
10
+ * xref:develop:api/reference/errors/recursion_limit_exceeded_error.adoc[Recursion limit error - RECURSION_LIMIT_EXCEEDED_ERROR] - is triggered when your query uses a GraphQL circular reference for more than two times.
11
+ * xref:develop:api/reference/errors/introspection_disabled_error.adoc[Introspection disabled error - INTROSPECTION_DISABLED_ERROR] - is triggered when a user attempts to run introspection and they do not have the required permissions.
12
+
13
+ == Authorization errors
14
+
15
+ * xref:develop:api/reference/errors/permission_not_set.adoc[Permission Not Set Error - PERMISSION_NOT_SET_ERROR], is triggered when there is a problem with the authorization layer.
16
+ * xref:develop:api/reference/errors/unauthorized_object.adoc[Unauthorized Object Error - UNAUTHORIZED_OBJECT_ERROR], is triggered when the requesting user does not have access to a certain resource.
17
+ * xref:develop:api/reference/errors/unauthorized_field.adoc[Unauthorized Field Error - UNAUTHORIZED_FIELD_ERROR], is triggered when the requesting user does not have access to a certain field or resource.
18
+ * xref:develop:api/reference/errors/unauthorized_mutation.adoc[Unauthorized Mutation Error - MUTATION_NOT_AUTHORIZED_ERROR], is triggered when the requesting user tries to access a mutation that cannot be accessed.
19
+
20
+ == Validation errors
21
+
22
+ * xref:develop:api/reference/errors/not_found.adoc[Not Found Error - NOT_FOUND_ERROR], is triggered when the requested record does not exist in database, or is in a state where you should not have access to it (moderated, belongs to an unpublished component, belongs to a private process where the requesting user does not have access)
23
+ * xref:develop:api/reference/errors/validation_error.adoc[Validation Error - VALIDATION_ERROR], is triggered when the requesting user performs an action that contains an error. This is equivalent to the flash messages displayed on the Website.
24
+ * xref:develop:api/reference/errors/attribute_validation_error.adoc[Attribute Validation Error - ATTRIBUTE_VALIDATION_ERROR], is triggered when the requesting user submits a request to alter a resource that has an error. This is equivalent to the validation errors in the HTTP forms.
25
+
26
+ == Internationalization errors
27
+
28
+ * xref:develop:api/reference/errors/locale_error.adoc[Locale Error - LOCALE_ERROR], is triggered when there is a problem with the internationalization, for example, a missing translation, a missing interpolation to the output string
29
+ * xref:develop:api/reference/errors/invalid_locale_error.adoc[Invalid Locale Error - INVALID_LOCALE_ERROR], is triggered when the provided locale is invalid or not supported by the system, for example when an unknown locale code is used or a locale that is not enabled for the current organization
@@ -2,37 +2,118 @@
2
2
 
3
3
  We only offer support for the last two mayor version.
4
4
 
5
- For instance, if we are on the version `0.28.0.dev`, we make backports for `v0.26.x` and `v0.27.x`. We only backport fixes and not features, as we want to respect xref:develop:guide_conventions.adoc[Semantic Versioning].
5
+ For instance, if we are on the version `0.32.0.dev`, we make backports for `v0.31.x` and `v0.30.x`. We only backport fixes and not features, as we want to respect xref:develop:guide_conventions.adoc[Semantic Versioning].
6
6
 
7
7
  The idea of a backport is to bring a given fix from the last development version to an older release.
8
8
 
9
9
  The process for making backports is the following:
10
10
 
11
- . Check in the git commit history what was the latest backports on the branch that you are working with. https://github.com/decidim/decidim/commits/release/0.27-stable[Example for v0.27]. Copy the number of the last PR backported.
12
- . Search in GitHub for the this PR in the list of merged PRs of the `type: fix`. https://github.com/decidim/decidim/pulls?page=1&q=is%3Apr+sort%3Aupdated-desc+label%3A%22type%3A+fix%22+is%3Amerged[Example URL].
13
- . Check the PRs merged just before and after this one. You need to find the last ones that were not backported already to start with the backport process. A fast way for checking this out is to open the PRs and see the mentions from the backports in the GitHub references.
14
- . Once you have the list of the PRs that you want to backport, you can start with the process by using the https://github.com/decidim/decidim-maintainers_toolbox[decidim-backporter script]. This script mostly handles the branch creation, cherrypicking, labeling and pushing of the fix. For using it you will need to have a GitHub Personal Access Token.
11
+ . Reproduce the error against develop.
12
+ . Develop a fix for the issue, starting from the develop.
13
+ . Open the Pull Request, adding the following labels: `type: fix`, `release: 0.xx`, in our example using `0.32.0.dev`, we would attach `type: fix`, `release: v0.31`.
14
+ . If the fix affects multiple versions, attach the corresponding release tag (for instance, `release: v0.30`).
15
+ . Be patient and wait for a maintainer to review and merge.
16
+ . Once it is merged, an automated workflow will attempt to apply the patch.
17
+ . If you have an already merged Pull Request, you can add another `release: v0.xx` tag, and this will retrigger the backport workflow. You do not need to decide when you open the PR which are the versions you want to backport to.
15
18
 
16
- This is an example on how this command is called:
19
+ == Maintainers only
17
20
 
18
- ```shell
19
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
20
- $ decidim-backporter --github-token=GITHUB_TOKEN --pull-request-id=10248 --version-number=0.27
21
- ```
21
+ In order to ease up the backport process, you will need to install the `decidim-maintainers_toolbox` gem.
22
22
 
23
- And this is the current full documentation for this script:
23
+ [source,bash]
24
+ ----
25
+ gem install decidim-maintainers_toolbox
26
+ ----
24
27
 
25
- ```shell
26
- $ decidim-backporter --help
28
+ This will provide you with some commands that you can use for day to day activities:
29
+
30
+ Before starting to use `decidim-maintainers_toolbox` gem, you will need to make sure that you have available the `gh` command, provided by `GitHub`. Follow the https://github.com/cli/cli[gh project's page] for installation steps that are most suited for your Operating System.
31
+
32
+ === decidim-backports-checker
33
+
34
+ The `decidim-backports-checker` is an utility that you can use to investigate which are the Pull Requests that needs to be backported.
35
+
36
+ [source, bash]
37
+ ----
38
+ Usage:
39
+ decidim-backports-checker --github-token=GITHUB_TOKEN --last-version-number=LAST_VERSION_NUMBER
40
+
41
+ Options:
42
+ --github-token=GITHUB_TOKEN # Required. Github Personal Access Token (PAT). It can be obtained from https://github.com/settings/tokens/new. You will need to create one with `public_repo` access.
43
+ Alternatively, you can use the `gh` CLI tool to authenticate with `gh auth token` (i.e. --github-token=$(gh auth token))
44
+ --last-version-number=LAST_VERSION_NUMBER # Required. The version number of the last supported version that you want to do the backports to. It must have the format MAJOR.MINOR.
45
+ [--days-to-check-from=N] # How many days since the pull requests were merged we will check from.
46
+ # Default: 90
47
+
48
+ Backports checker. Shows the status of the pull requests opened in the last days
49
+
50
+ The output by default is for the terminal. It uses a color code to differentiate the status of the Pull Requests, following the colors of GitHub:
51
+ - Purple: closed with a merge
52
+ - Red: closed without being merge
53
+ - Green: opened without being merge
54
+ ----
55
+
56
+ Any maintainer that wants to see the pending Pull Requests that needs to be backported to a specific version, should type in the following command:
57
+
58
+ [source, bash]
59
+ ----
60
+ decidim-backports-checker --github-token=$(gh auth token) --last-version-number=0.31
61
+ ----
62
+ In our previous example, we have the develop branch set to be on 0.32.0.dev, which means that our latest released minor version is 0.31. We are using the minor version regardless if we are at `0.31.0.rc2`, `0.31.0` or `0.31.1`.
63
+
64
+ image::maintainers-backports-checker.png[decidim-backports-checker output]
65
+
66
+ In the above picture:
67
+
68
+ - `15501` is a Pull Request that has been only opened for `0.31`, with no active backport to `0.30`.
69
+ - `15201` is a Pull Request that has only been backported to `0.30`
70
+ - `15181` is a Pull Request that has not been backported, or the automated backport script failed
71
+ - We do not displayed a merged backport Pull Request.
72
+
73
+ If you want to address a PR only for a specific version, you open the Pull Request for that version, then you can add `no-backport` label for the Pull Request that you do not want to backport to the oldest version.
74
+
75
+ If a Pull Request is fully backported (merged backport Pull Requests in `0.31` and `0.30` versions), then the line will not be displayed.
76
+
77
+ === decidim-backporter
78
+
79
+ As previously mentioned, we have an automated tool that will try to add create the backports automatically, but sometimes, due to conflicts the automated backport is not possible, so you need to use the `decidim-backporter` command.
80
+
81
+ [source, bash]
82
+ ----
27
83
  Usage:
28
84
  decidim-backporter --github-token=GITHUB_TOKEN --pull-request-id=PULL_REQUEST_ID --version-number=VERSION_NUMBER
29
85
 
30
86
  Options:
31
- --github-token=GITHUB_TOKEN # Required. GitHub Personal Access Token (PAT). It can be obtained from https://github.com/settings/tokens/new. You will need to create one with `public_repo` access.
32
- --version-number=VERSION_NUMBER # Required. The version number that you want to do the backport to. It must have the format MAJOR.MINOR.
33
- --pull-request-id=PULL_REQUEST_ID # Required. The ID of the pull request that you want to make the backport from. It should have the "type: fix" label.
34
- [--exit-with-unstaged-changes], [--no-exit-with-unstaged-changes] # Optional. Whether the script should exit with an error if there are unstaged changes in the current project.
35
- # Default: true
87
+ --github-token=GITHUB_TOKEN # Required. Github Personal Access Token (PAT). It can be obtained from https://github.com/settings/tokens/new. You will need to create one with `public_repo` access.
88
+ Alternatively, you can use the `gh` CLI tool to authenticate with `gh auth token` (i.e. --github-token=$(gh auth token))
89
+ --version-number=VERSION_NUMBER # Required. The version number that you want to do the backport to. It must have the format MAJOR.MINOR.
90
+ --pull-request-id=PULL_REQUEST_ID # Required. The ID of the pull request that you want to make the backport from. It should have the "type: fix" label.
91
+ [--exit-with-unstaged-changes], [--no-exit-with-unstaged-changes], [--skip-exit-with-unstaged-changes] # Optional. Whether the script should exit with an error if there are unstaged changes in the current project.
92
+ # Default: true
93
+ [--with-console], [--no-with-console], [--skip-with-console] # Optional. Disables the shell dropout
94
+ # Default: true
36
95
 
37
96
  Backport a pull request to another branch
38
- ```
97
+ ----
98
+
99
+ An example of the command is:
100
+
101
+ [source, bash]
102
+ ----
103
+ decidim-backporter --github-token=$(gh auth token) --pull-request-id=1234 --version-number=0.31
104
+ ----
105
+
106
+ In this particular example, 1234 is the Pull Request merged against develop branch, while `--version-number` is the version where we want to backport.
107
+ We do not need to pass the full version, as this will apply the fix only for the unreleased versions, regardless if we are on `0.31.0.rc1`, `0.31.0` or `0.31.1`
108
+
109
+ The command will attempt to apply the patch, and if the patch fails with error, a console will be displayed, allowing you to change the files in your editor. After the conflict is fixed, you will need to write the following in your console:
110
+ [source, bash]
111
+ ----
112
+ git add <any conflicting files that you fixed>
113
+ git cherry-pick --continue
114
+ # type logout or press CTRL + D
115
+ ----
116
+
117
+ The process will continue creating the backport Pull Request.
118
+
119
+ If you want to skip the backport creation for any reason, you just need to ensure that when your console drops, you do not have staged / modified files. Typing a `git cherry-pick --abort` will clean the backport process. After that you just need to exit the console with either `logout` or `CTRL+D`.