chore: dry out 410 logic (#45257)

This commit is contained in:
Naomi Carrigan
2022-02-25 11:08:18 -08:00
committed by GitHub
parent c2105c17f3
commit 9e03419efb
4 changed files with 15 additions and 31 deletions

View File

@@ -1,10 +1,11 @@
import { getRedirectParams } from '../utils/redirection';
import { deprecatedEndpoint } from '../utils/deprecatedEndpoint';
module.exports = function (app) {
const router = app.loopback.Router();
const User = app.models.User;
router.get('/api/github', gone);
router.get('/api/github', deprecatedEndpoint);
router.get('/u/:email', unsubscribeDeprecated);
router.get('/unsubscribe/:email', unsubscribeDeprecated);
router.get('/ue/:unsubscribeId', unsubscribeById);
@@ -12,15 +13,6 @@ module.exports = function (app) {
app.use(router);
function gone(_, res) {
return res.status(410).json({
message: {
type: 'info',
message: 'Please reload the app, this feature is no longer available.'
}
});
}
function unsubscribeDeprecated(req, res) {
req.flash(
'info',