Skip to content

Commit

Permalink
Merge branch 'master' of github.com:OneGov/onegov-cloud into ogc-1940…
Browse files Browse the repository at this point in the history
…-links-zu-kontakten-einfugen
  • Loading branch information
cyrillkuettel committed Feb 11, 2025
2 parents 067bdde + 5189b63 commit f7aa27b
Show file tree
Hide file tree
Showing 73 changed files with 4,486 additions and 2,772 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
exclude: .pre-commit-config.yaml
- id: pt_structure
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.2
rev: v0.9.4
hooks:
- id: ruff
args: [ "--fix" ]
Expand All @@ -32,7 +32,7 @@ repos:
- id: sass-lint
files: '^src/.*\.scss'
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.18.0
rev: v9.19.0
hooks:
- id: eslint
files: '^src/.*\.jsx?$'
Expand Down
4,956 changes: 2,484 additions & 2,472 deletions .test_durations

Large diffs are not rendered by default.

100 changes: 75 additions & 25 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,82 @@
# Changes

## 2025.4

`2025-01-31` | [c0942af43d...68aa420b48](https://github.com/OneGov/onegov-cloud/compare/c0942af43d^...68aa420b48)

### Api

##### Add documentation

`Feature` | [OGC-2036](https://linear.app/onegovcloud/issue/OGC-2036) | [42524e6d9a](https://github.com/onegov/onegov-cloud/commit/42524e6d9a5f091e0c0bdeb0b8ccf5e55a36916f)

### Directories

##### Only send delayed email notifications for 'public' and 'mtan' access levels.

`Bugfix` | [OGC-2044](https://linear.app/onegovcloud/issue/OGC-2044) | [41b2f79431](https://github.com/onegov/onegov-cloud/commit/41b2f79431f89896b6c3d3baea0b34a0cc1a04ca)

### Feriennet

##### Google Tag Manager

Replace script

`Feature` | [OGC-1353](https://linear.app/onegovcloud/issue/OGC-1353) | [40481da20c](https://github.com/onegov/onegov-cloud/commit/40481da20ca8e140655dbc7cb694ad5562089080)

### Form

##### Add formcode definitions

Add more possible definitions in the form editor to choose from.

`Feature` | [OGC-1942](https://linear.app/onegovcloud/issue/OGC-1942) | [382bcc60b5](https://github.com/onegov/onegov-cloud/commit/382bcc60b5f945b067a2920bb8eacd9b71f0cf87)

### Gis

##### Prevents accidentally changing the zoom on the map.

`Feature` | [OGC-1944](https://linear.app/onegovcloud/issue/OGC-1944) | [a91c91e17b](https://github.com/onegov/onegov-cloud/commit/a91c91e17b51db7b96bd6f959c4db653bfb6b0d4)

### Newsletter

##### Adds option to notify admins if a user unsubscribes from the newsletter subscription list

`Feature` | [OGC-2037](https://linear.app/onegovcloud/issue/OGC-2037) | [08e795f772](https://github.com/onegov/onegov-cloud/commit/08e795f772d3bb0c322fb7e1693bb412c0fcbe88)

### Org

##### Collect inactive email addresses daily and indicate delivery failures for newsletter recipients

`Feature` | [OGC-1896](https://linear.app/onegovcloud/issue/OGC-1896) | [821ff43296](https://github.com/onegov/onegov-cloud/commit/821ff43296c1ab9ce88297a1e17cac3b647252e9)

### Pay

##### Adds Datatrans payment provider

`Feature` | [OGC-2007](https://linear.app/onegovcloud/issue/OGC-2007) | [cdf4acbdd8](https://github.com/onegov/onegov-cloud/commit/cdf4acbdd8fe3a3b15f10929342189be13a743e7)

### Town6

##### Show creation date in imagesets.

`Feature` | [OGC-1901](https://linear.app/onegovcloud/issue/OGC-1901) | [4507af6c4c](https://github.com/onegov/onegov-cloud/commit/4507af6c4ccf8f32fda65be79792e3f9ed369e30)

##### Add text_link in homepage widget markdown file

`Feature` | [cf0b91c727](https://github.com/onegov/onegov-cloud/commit/cf0b91c727bb962297278d089552ecee796002d0)

##### Add option for label text

`Feature` | [OGC-2040](https://linear.app/onegovcloud/issue/OGC-2040) | [e59d03389d](https://github.com/onegov/onegov-cloud/commit/e59d03389dc422d3d91abed86e9e4ee9dbd540aa)

##### Make deleting a link more accessible.

`Bugfix` | [OGC-739](https://linear.app/onegovcloud/issue/OGC-739) | [4d318fc9bf](https://github.com/onegov/onegov-cloud/commit/4d318fc9bf898c38fa34f747fee7698f2bb14a08)

## 2025.3

`2025-01-23` | [9eabea3e30...d2c4c7dedd](https://github.com/OneGov/onegov-cloud/compare/9eabea3e30^...d2c4c7dedd)
`2025-01-23` | [9eabea3e30...f3e1dbff9c](https://github.com/OneGov/onegov-cloud/compare/9eabea3e30^...f3e1dbff9c)

### Electionday

Expand Down Expand Up @@ -2161,27 +2235,3 @@ onegov.translator_directory.views.translator.view_mail_templates

`2024-03-28` | [aaa823d7d9...b238279400](https://github.com/OneGov/onegov-cloud/compare/aaa823d7d9^...b238279400)

## 2024.18

`2024-03-28` | [ed9dcdad14...8f182f3b09](https://github.com/OneGov/onegov-cloud/compare/ed9dcdad14^...8f182f3b09)

### Election Day

##### Cleanup unused code and increase test coverage.

`Feature` | [53e2a262b3](https://github.com/onegov/onegov-cloud/commit/53e2a262b3352a1ca87820d1b9bd483507b00fbc)

### Swissvotes

##### Add english bfs map link and transform bfs map url when embedding the new dashboard.

`Feature` | [SWI-46](https://linear.app/swissvotes/issue/SWI-46) | [17c12a396f](https://github.com/onegov/onegov-cloud/commit/17c12a396fd92b05af440acd1569ee38e0eb39cb)

##### Adds missing upgrade step and resolves fixmes.

`Bugfix` | [OGC-1546](https://linear.app/onegovcloud/issue/OGC-1546) | [e6401e1843](https://github.com/onegov/onegov-cloud/commit/e6401e1843ac871add5464f604c662620579be93)

##### Update display of campaign finances.

`Other` | [SWI-43](https://linear.app/swissvotes/issue/SWI-43) | [253d3bccfe](https://github.com/onegov/onegov-cloud/commit/253d3bccfe5f3697f030c8bf8c6a6eba91da9fb8)

17 changes: 11 additions & 6 deletions docs/api/org/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ The headless Org API offers the following views:

- [Events](#events-view)
- [News](#news-view)
- [Topics](#topics-view)

We implement the called Collection+JSON standard established by Mike
Amundsen. For details please refer to [media types - collection & json](http://amundsen.com/media-types/collection/format/)
Expand Down Expand Up @@ -122,13 +123,17 @@ A collection+JSON of items including paging

## News View

The news view provides information about all people in relation with agencies
within the organisation. Each person offers several data fields like
first and last name, academic title, function within the organisation,
contact information and more. Additionally, the people api provides links to
a picture, website and memberships to agencies memberships if given.
The news view provides information about all the news.

`curl https://[base_url]/people`
`curl https://[base_url]/news`

## Topics View

The topics view provides information about all the topics, including
their hierarchical relationship via a `parent` link. Links to children
are implicit through their `parent` link.

`curl https://[base_url]/topics`


## Authorization
Expand Down
24 changes: 14 additions & 10 deletions homepage_widget_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ There are two different types of rows, `<row-wide> </row-wide>` and `<row> </row
</title>
```
| Attribute Name | Description | Value if left empty | Possible Values |
| ------------- | ------------------------------------------ | ------------------- | ---------------------- |
| ------------- | ------------------------------------------ | ------------------- | ---------------------- |
| `class` | Custom classes | - | Any class name |


Expand Down Expand Up @@ -79,9 +79,11 @@ The images for the slider are defined via photoalbums. You can find the "show on
## Autoplay Video(s)
[![Autoplay Video](docs/_static/homepage_widgets//autoplay_video.png?raw=true)]()
```
<autoplay_video
<autoplay_video
max-height="100vh"
text="Text on video"
button_url="https://..."
button_text="Button Text"
link_mp4="/storage/..."
link_mp4_low_res="/storage/..."
link_webm="/storage/..."
Expand All @@ -92,6 +94,8 @@ The images for the slider are defined via photoalbums. You can find the "show on
| ------------- | ------------------------------------------ | ------------------- | ---------------------- |
| `max-height` | The *maximum* height of the video. Can for example be used for fullscreen videos on desktop. The video will center itself in the available space. | Video height | 30vw, 40vh, 100px, ... |
| `text` | Text to be shown atop of the video | - | Any text |
| `button_url` | Adds a button linked to the url | - | https://... |
| `button_text` | Text used as the label of the button. Button only appears if there is a button_url. | "Show more" | Any text |
| `link_mp4_low_res` | Link to the video in the mp4 format with reduced size uploaded in the files-section. Will be shown for mobile devices instead of the full sized video. | - | /storage/... |
| `link_mp4` | Link to the full sized video in the mp4 format uploaded in the files-section. Will be shown for desktop and mobile, if no smaller size is available. | - | /storage/... |
| `link_webm_low_res` | Link to the video in the webm format with reduced size uploaded in the files-section. Will be shown for mobile devices instead of the full sized video. | - | /storage/... |
Expand All @@ -101,9 +105,9 @@ The images for the slider are defined via photoalbums. You can find the "show on
You can add multiple videos and wrap them with `<random_videos> </random_videos>` to display one of the videos at random each time the page gets refreshed. Like this:
```
<random_videos>
<autoplay_video
<autoplay_video
link_mp4="/storage/video_1" />
<autoplay_video
<autoplay_video
link_mp4="/storage/video_2" />
</random_videos>
Expand All @@ -113,8 +117,8 @@ You can add multiple videos and wrap them with `<random_videos> </random_videos>
## Icon Links
[![Icon Links](docs/_static/homepage_widgets//icon_links.png?raw=true)]()
```
<icon_link
icon="fa-concierge-bell"
<icon_link
icon="fa-concierge-bell"
title="Online-Schalter"
link="/forms"
text="Nehmen Sie online bequem Dienstleistungen in Anspruch"
Expand Down Expand Up @@ -177,7 +181,7 @@ You can adjust the number of displayed events in the homepage-settings form.

## Partners
[![Partners](docs/_static/homepage_widgets//partners.png?raw=true)]()
```
```
<partners />
```
| Attribute Name | Description | Value if left empty | Possible Values |
Expand Down Expand Up @@ -210,13 +214,13 @@ The label and visibility of the services can be edited in the homepage settings.

## Contacts
[![Contacts](docs/_static/homepage_widgets/people.png?raw=true)]()
```
```
<contacts_and_albums/>
```

## Directories
[![Directories](docs/_static/homepage_widgets/directories.png?raw=true)]()
```
```
<directories/>
```

Expand Down Expand Up @@ -290,7 +294,7 @@ The label and visibility of the services can be edited in the homepage settings.

## Jobs
[![Jobs](docs/_static/homepage_widgets//jobs.png?raw=true)]()
```
```
<jobs
rss_feed="https://www.publicjobs.ch/rss/~search1576049765b9fb8a630d17ec5dfcce06841a6e"
jobs_card_title="Looking for ..."
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ install_requires =
qrbill
qrcode
py
pycountry
pydantic
pydantic-extra-types
pyotp
pysaml2
python-dateutil
Expand Down
2 changes: 1 addition & 1 deletion src/onegov/activity/models/invoice_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ def amount(cls) -> ColumnElement[Decimal | None]:

@validates('source')
def validate_source(self, key: str, value: str | None) -> str | None:
assert value in (None, 'xml', 'stripe_connect')
assert value in (None, 'xml', 'datatrans', 'stripe_connect')
return value
2 changes: 1 addition & 1 deletion src/onegov/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
from __future__ import annotations

__version__ = '2025.3'
__version__ = '2025.4'

# The module levels used for dependency tests and to have a well defined
# onegov core upgrade order.
Expand Down
4 changes: 2 additions & 2 deletions src/onegov/core/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def extended_date_encode(d: date | None) -> str:
)


@overload # type:ignore[overload-overlap]
def json_decode(s: Literal['']) -> None: ...
@overload
def json_decode(s: Literal['']) -> None: ... # type:ignore[overload-overlap]
@overload
def json_decode(s: str) -> dict[str, Any]: ...

Expand Down
23 changes: 23 additions & 0 deletions src/onegov/core/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,18 @@ def theme_link(self) -> str:

return self.link(self.app.modules.theme.ThemeFile(filename))

def get_session_nonce(self) -> str:
""" Returns a nonce that can be passed as a POST parameter
to restore a session in a context where the session cookie
is unavailable, due to `SameSite=Lax`.
"""
nonce = random_token()
self.app.cache.set(
nonce,
self.app.sign(self.browser_session._token, nonce),
)
return self.app.sign(nonce)

@cached_property
def browser_session(self) -> BrowserSession:
""" Returns a browser_session bound to the request. Works via cookies,
Expand Down Expand Up @@ -377,6 +389,17 @@ def browser_session(self) -> BrowserSession:
# infinite CSRF errors
del self.cookies['session_id']
session_id = random_token()

elif isinstance(signed_nonce := self.POST.get('session_nonce'), str):
nonce = self.app.unsign(signed_nonce)
session_id = random_token()
if nonce:
# restore the session in a non SameSite context
signed_session_id = self.app.cache.get(nonce)
if signed_session_id:
# make sure this nonce can't be reused
self.app.cache.delete(nonce)
session_id = self.app.unsign(signed_session_id, nonce)
else:
session_id = random_token()

Expand Down
5 changes: 1 addition & 4 deletions src/onegov/feriennet/templates/macros.pt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
<!-- Google Tag Manager -->
<script>
/* eslint-disable */
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});
var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';
j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WTBG4FX');
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://beobachten.projuventute.ch/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-WTBG4FX');
/* eslint-enable */
</script>
<!-- End Google Tag Manager -->
Expand Down
6 changes: 3 additions & 3 deletions src/onegov/feriennet/views/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ def payment_button(title: str, price: Price | None) -> str | None:
title=title,
price=price,
email=user.username,
locale=request.locale
complete_url=request.link(self),
request=request,
)

def user_select_link(user: User) -> str:
Expand Down Expand Up @@ -197,8 +198,7 @@ def handle_payment(

provider = request.app.default_payment_provider
assert provider is not None
token = request.params.get('payment_token')
assert token is None or isinstance(token, str)
token = provider.get_token(request)
# FIXME: Can period actually be omitted, i.e. are there
# cases where we only get a single Invoice when we
# omit the period?
Expand Down
Loading

0 comments on commit f7aa27b

Please sign in to comment.