Skip to content

Commit 8b2cc4b

Browse files
committed
Merge remote-tracking branch 'other/dev'
2 parents 562b5d3 + 4531999 commit 8b2cc4b

49 files changed

Lines changed: 1697 additions & 525 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = {
1515
"**/node_modules/**",
1616
"**/dist/**",
1717
"**/build/**",
18+
"**/coverage/**",
1819
".eslintrc.js",
1920
"jest.config.js",
2021
"*.svg",

CHANGELOG.md

Lines changed: 130 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,144 @@
11
# Changelog
22

3+
## 2.0.0-rc.2
4+
5+
**Bug fixes and improvements:**
6+
7+
- Fixed answer options from non-default languages not being valid for signups
8+
- Fixed answer options getting desynced between languages when changing question types
9+
- The event editor no longer shows a non-functional "Create signup" button when there are no quotas
10+
11+
## 2.0.0-rc.1
12+
13+
**Breaking changes:**
14+
15+
- **API:** Improved event validation errors, some HTTP status codes changed
16+
17+
**Features:**
18+
19+
- Added a button to copy events
20+
21+
**Bug fixes and improvements:**
22+
23+
- Include event info in signup creation audit logs
24+
- Fix event editor crashing for events with no language version in the app's default language
25+
326
## 2.0.0-alpha46
427

28+
**Bug fixes and improvements:**
29+
530
- Avoid another error for older servers in `getLocalizedEvent`
631

732
## 2.0.0-alpha45
833

9-
- **Breaking (ilmomasiina-client):** Replaced `getLocalizedQuotaForEditSignup` with `getLocalizedSignup`
34+
**Breaking changes:**
35+
36+
- **ilmomasiina-client:** Replaced `getLocalizedQuotaForEditSignup` with `getLocalizedSignup`
37+
38+
**Bug fixes and improvements:**
39+
1040
- Fix localization of current quota in signup editor
1141
- Avoid errors for older servers in `getLocalizedEvent`
1242

1343
## 2.0.0-alpha44
1444

45+
**Features:**
46+
1547
- Also build ESM versions of public packages
1648

1749
## 2.0.0-alpha43
1850

51+
**Bug fixes and improvements:**
52+
1953
- Minor typing improvements
2054

2155
## 2.0.0-alpha42
2256

23-
- **BREAKING:** Restructuring moved all customization to the `@tietokilta/ilmomasiina-frontend` package.
24-
- **Breaking (ilmomasiina-components):** Replaced the `@tietokilta/ilmomasiina-components` package with
57+
**Breaking changes:**
58+
59+
- **Customization:** Restructuring moved all customization to the `@tietokilta/ilmomasiina-frontend` package.
60+
- **ilmomasiina-components:** Replaced the `@tietokilta/ilmomasiina-components` package with
2561
`ilmomasiina-client`, which gets rid of shared React components and only provides API helpers, React hooks for state
2662
and API, and locale strings
27-
- **Feature:** Added comprehensive multi-language support to events; API is backwards compatible and older clients will
63+
64+
**Features:**
65+
66+
- Added comprehensive multi-language support to events; API is backwards compatible and older clients will
2867
see the default language of events
68+
69+
**Bug fixes and improvements:**
70+
2971
- Localization fixes
3072
- Updated dependencies
3173
- Development environment improvements
3274

3375
## 2.0.0-alpha41
3476

77+
**Bug fixes and improvements:**
78+
3579
- Fix issue that caused failure in rendering the CreateEvent page
3680

37-
## 2.0.0.-alpha40
81+
## 2.0.0-alpha40
82+
83+
**Bug fixes and improvements:**
3884

3985
- Fix issue that caused the backend to lock up on concurrent signups
4086

4187
## 2.0.0-alpha39
4288

43-
- **Feature:** Admins can now create and edit signups via the Signups tab
44-
- **Feature:** Admins can now view signups grouped by quota
45-
- Quota information is now consistently hidden when signups are disabled for an event
89+
**Features:**
90+
91+
- Admins can now create and edit signups via the Signups tab
92+
- Admins can now view signups grouped by quota
4693
- Signup creation is now audit logged to mitigate spamming
94+
95+
**Bug fixes and improvements:**
96+
97+
- Quota information is now consistently hidden when signups are disabled for an event
4798
- Minor layout and styling improvements to frontend
4899

49100
## 2.0.0-alpha38
50101

102+
**Bug fixes and improvements:**
103+
51104
- Fix answers sticking around when updating a signup
52105

53106
## 2.0.0-alpha37
54107

55-
- **BREAKING:** Past events are now accessed using the `maxAge` parameter instead of `since`
108+
**Breaking changes:**
109+
110+
- **API:** Past events are now accessed using the `maxAge` parameter instead of `since`
111+
112+
**Features:**
113+
56114
- The cutoff for old event viewing by regular users is now configurable via `HIDE_EVENT_AFTER_DAYS`
57-
- Further bug fixes to past events
58115
- Add API for admins to create and edit signups
59116

117+
**Bug fixes and improvements:**
118+
119+
- Further bug fixes to past events
120+
60121
## 2.0.0-alpha36
61122

123+
**Bug fixes and improvements:**
124+
62125
- Bug fixes to past events
63126

64127
## 2.0.0-alpha35
65128

129+
**Bug fixes and improvements:**
130+
66131
- Bug fixes to past events
67132

68133
## 2.0.0-alpha34
69134

70-
- **BREAKING:** Add logo to Header - make sure to change or disable it on your instance
71-
- **BREAKING:** Add dark mode variants of favicons - make sure to update yours
135+
**Breaking changes:**
136+
137+
- **Customization:** Add logo to Header - make sure to change or disable it on your instance
138+
- **Customization:** Add dark mode variants of favicons - make sure to update yours
139+
140+
**Features:**
141+
72142
- The remaining time to confirm or edit a signup is now shown on the signup form
73143
- Signups can now be edited for `SIGNUP_CONFIRM_MINS` minutes after creation, even if created just before an event's
74144
signup closes, if configured with `SIGNUP_CONFIRM_AFTER_CLOSE` (recommended).
@@ -78,80 +148,118 @@
78148

79149
## 2.0.0-alpha33
80150

151+
**Bug fixes and improvements:**
152+
81153
- Fixed radio/checkbox field layout when answers are invalid
82154

83155
## 2.0.0-alpha32
84156

157+
**Bug fixes and improvements:**
158+
85159
- Editor fields no longer incorrectly cause errors when cleared
86160
- Underlines on links are now only used in select places when enabled
87161

88162
## 2.0.0-alpha31
89163

90-
- **Feature:** The event editor now gives per-field validation feedback and limits e.g. field lengths
91-
- **Feature:** Events can now be previewed from the event editor
92-
- **Feature:** Past events are now shown in a separate list for admins
93-
- **Feature:** The event editor now allows setting a price for events (only a string, no special handling)
164+
**Features:**
165+
166+
- The event editor now gives per-field validation feedback and limits e.g. field lengths
167+
- Events can now be previewed from the event editor
168+
- Past events are now shown in a separate list for admins
169+
- The event editor now allows setting a price for events (only a string, no special handling)
170+
- The signup closure date is now shown in various places after signup closes
171+
172+
**Bug fixes and improvements:**
173+
94174
- Links are now easier to see with dark theme colors
95175
- Signup start/end time and signup publicity are now part of "basic details" in the event editor
96-
- The signup closure date is now shown in various places after signup closes
97176
- Quota name is no longer shown in signup lists when there's only one quota
98177
- Quota size fields now have placeholders to indicate what empty means
99178
- TypeBox schemas now use Composite instead of Intersect for cleaner schemas
100179

101180
## 2.0.0-alpha30
102181

103-
- **BREAKING:** Changed default brand colors in email templates
182+
**Breaking changes:**
183+
184+
- **Customization:** Changed default brand colors in email templates
104185

105186
## 2.0.0-alpha29
106187

107-
- **Feature:** Added user-friendly validation of signup fields
108-
- **Feature:** Admin tokens now renew automatically, significantly reducing expired session errors
188+
**Features:**
189+
190+
- Added user-friendly validation of signup fields
191+
- Admin tokens now renew automatically, significantly reducing expired session errors
109192

110193
## 2.0.0-alpha28
111194

112-
- **Feature:** Queue positions are now shown in signup confirmation emails
195+
**Features:**
196+
197+
- Queue positions are now shown in signup confirmation emails
113198

114199
## 2.0.0-alpha27
115200

201+
**Bug fixes and improvements:**
202+
116203
- Fixed a bug in external integrations
117204

118205
## 2.0.0-alpha26
119206

207+
**Bug fixes and improvements:**
208+
120209
- Improved integration options for external sites
121210
- Removed Moment.js from the frontend
122211
- Formatted source code with Prettier
123212

124213
## 2.0.0-alpha25
125214

215+
**Bug fixes and improvements:**
216+
126217
- Fixed a bug where deleted events would still keep their slugs reserved
127218

128219
## 2.0.0-alpha24
129220

221+
**Bug fixes and improvements:**
222+
130223
- Fixed a bug that broke events when questions were created with options
131224

132225
## 2.0.0-alpha23
133226

227+
**Bug fixes and improvements:**
228+
134229
- Fixed open quota size field
135230

136231
## 2.0.0-alpha22
137232

233+
**Bug fixes and improvements:**
234+
138235
- Fixed a CI bug
139236

140237
## 2.0.0-alpha21
141238

239+
**Bug fixes and improvements:**
240+
142241
- Fixed unlimited size quotas not working
143242

144243
## 2.0.0-alpha20
145244

245+
**Bug fixes and improvements:**
246+
146247
- Fixed a CI bug
147248

148249
## 2.0.0-alpha19
149250

251+
**Bug fixes and improvements:**
252+
150253
- Fixed a bug where signups couldn't be saved without an email field
151254

152255
## 2.0.0-alpha18
153256

154-
- **BREAKING:** Changed default brand colors in frontend & components
257+
**Breaking changes:**
258+
259+
- **Customization:** Changed default brand colors in frontend & components
260+
261+
**Bug fixes and improvements:**
262+
155263
- Significant performance optimizations
156264
- Multiple bug fixes
157265
- Dependency upgrades, code quality and development improvements

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ Ilmomasiina is easy to [install](docs/installation.md) in various environments a
88
is freely available for all organizations to use.
99
[Migrating](docs/migration.md) from the Athene-made version is also supported.
1010

11-
The latest reviewed development version is in the `dev` branch. You may want to check
12-
current PRs for somewhat stable feature additions.
13-
14-
**Please note that the code is currently in alpha phase and may still have bugs.**
15-
Major features for 2.0 are mostly done and we expect to reach a stable beta in spring 2024.
11+
Releases are made as Git tags and follow semantic versioning.
12+
The latest reviewed development version is in the `dev` branch.
1613

1714
## Installation
1815

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ilmomasiina",
3-
"version": "2.0.0-alpha46",
3+
"version": "2.0.0-rc.2",
44
"private": true,
55
"license": "MIT",
66
"engines": {

packages/ilmomasiina-backend/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tietokilta/ilmomasiina-backend",
3-
"version": "2.0.0-alpha46",
3+
"version": "2.0.0-rc.2",
44
"license": "MIT",
55
"repository": {
66
"type": "git",
@@ -15,9 +15,10 @@
1515
"stop:prod": "pm2 stop 0",
1616
"monit:prod": "pm2 monit",
1717
"build": "tsc --build tsconfig.build.json",
18-
"clean": "rimraf dist",
18+
"clean": "rimraf dist coverage",
1919
"typecheck": "tsc --build tsconfig.build.json",
2020
"test": "vitest",
21+
"test:coverage": "vitest run --coverage",
2122
"filldb": "ts-node -r tsconfig-paths/register --project tsconfig.json test/fillDatabase.ts"
2223
},
2324
"betterScripts": {
@@ -92,6 +93,7 @@
9293
"@types/node-cron": "^3.0.11",
9394
"@types/nodemailer": "^6.4.17",
9495
"@types/nodemailer-mailgun-transport": "^1.4.6",
96+
"@vitest/coverage-v8": "^1.4.0",
9597
"rimraf": "^5.0.10",
9698
"ts-node": "^10.9.2",
9799
"ts-node-dev": "^2.0.0",

packages/ilmomasiina-backend/src/app.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,9 @@ export default async function initApp(): Promise<FastifyInstance> {
121121
},
122122
});
123123

124-
server.register(setupRoutes, {
125-
prefix: "/api",
126-
adminSession: new AdminAuthSession(config.feathersAuthSecret),
127-
});
124+
server.decorate("adminSession", new AdminAuthSession(config.feathersAuthSecret));
125+
126+
server.register(setupRoutes, { prefix: "/api" });
128127

129128
if (config.nodeEnv !== "test") {
130129
// Every minute, remove signups that haven't been confirmed fast enough
@@ -145,6 +144,7 @@ export default async function initApp(): Promise<FastifyInstance> {
145144

146145
declare module "fastify" {
147146
interface FastifyInstance {
147+
adminSession: AdminAuthSession;
148148
/** If set to false, GET /api/events raises an error.
149149
* This is "cached" in the application instance to avoid an unnecessary database query.
150150
*/

packages/ilmomasiina-backend/src/auditlog/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function eventLogger(ipAddress: string, user?: () => string | null) {
3434
eventId: event?.id || signup?.quota?.event?.id || null,
3535
eventName: event?.title || signup?.quota?.event?.title || null,
3636
signupId: signup?.id || null,
37-
signupName: signup ? `${signup.firstName} ${signup.lastName}` : null,
37+
signupName: signup?.firstName != null ? `${signup.firstName} ${signup.lastName}` : null,
3838
extra: extra ? JSON.stringify(extra) : null,
3939
ipAddress,
4040
},

packages/ilmomasiina-backend/src/authentication/adminAuthSession.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { FastifyRequest } from "fastify";
33

44
import type { UserID, UserSchema } from "@tietokilta/ilmomasiina-models";
55
import config from "../config";
6+
import { User } from "../models/user";
67
import { BadSession } from "./errors";
78

89
export interface AdminTokenData {
@@ -33,8 +34,8 @@ export default class AdminAuthSession {
3334
*
3435
* @param userData admin user information to be included into the token
3536
*/
36-
createSession(userData: AdminTokenData): string {
37-
return this.sign(userData);
37+
createSession(user: User): string {
38+
return this.sign({ user: user.id, email: user.email });
3839
}
3940

4041
/**

0 commit comments

Comments
 (0)