FAForever / FAForever/website

Flash, flash & flash, the system is broken and we need some alternative

Open
#521 1 comment 0 reactions 0 assignees View on GitHub
Bug
Dominant language
JavaScript
Stars
23
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Current status:
most of the flash messages are not working.

including some weird configurations with:
```JavaScript
flash.type = 'Error!'
flash.class = 'alert-danger'
flash.messages = [{ msg: 'The invitation link is wrong or truncated. Key informations are missing.' }]

const buff = Buffer.from(JSON.stringify(flash))
const data = buff.toString('base64')

return res.redirect('/clans?flash=' + data)
```

there is an old flash implementation https://github.com/jaredhanson/connect-flash, but this is 10 years old and actually not used in the code, we start it with:

```JavaScript
#AppKernel
this.expressApp.use(flash())
this.expressApp.use((req, res, next) => {
res.locals.message = req.flash()
next()
})
```
but never written or used in the templates....

To stop this madness, we need a proper session-flash implementation and stop using multiple systems or structures.
No reddirest with "?flash=knhdsfapoinbgoiua", no custom made objects and template mixins.

Base Acceptance criteria:
- if the user destroys a clan or makes any mutating action, a flash message should be saved in the session
- on rendering a site, a flash-message should pop up

non-goals:
- using flash messages to show validation errors

something like

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.