diff --git a/components/Authors.vue b/components/Authors.vue index 3f55b269..4c3ac076 100644 --- a/components/Authors.vue +++ b/components/Authors.vue @@ -1,30 +1,39 @@ diff --git a/components/Header.vue b/components/Header.vue index 5ee7a2a2..f5b50859 100644 --- a/components/Header.vue +++ b/components/Header.vue @@ -181,6 +181,7 @@ link: '/' + this.config.contact.route, icon: 'comment-alt-smile', text: this.$t('contact.header'), + extra: ['/' + this.config.contact.team.route], }); } diff --git a/components/Icon.vue b/components/Icon.vue index 54546b85..e1dd43c5 100644 --- a/components/Icon.vue +++ b/components/Icon.vue @@ -1,5 +1,6 @@ + + diff --git a/server/routes/admin.js b/server/routes/admin.js index 5940e7ea..98f15402 100644 --- a/server/routes/admin.js +++ b/server/routes/admin.js @@ -2,10 +2,56 @@ import { Router } from 'express'; import SQL from 'sql-template-strings'; import avatar from '../avatar'; import {config as socialLoginConfig} from "../social"; -import {now, sortByValue} from "../../src/helpers"; +import {buildDict, now, sortByValue} from "../../src/helpers"; +import locales from '../../src/locales'; const router = Router(); +router.get('/admin/list', async (req, res) => { + const admins = await req.db.all(SQL` + SELECT u.username, p.teamName, p.locale, u.id, u.email, u.avatarSource + FROM users u + LEFT JOIN profiles p ON p.userId = u.id + WHERE p.teamName IS NOT NULL AND p.teamName != '' + ORDER BY RANDOM() + `); + + const adminsGroupped = buildDict(function*() { + yield [req.config.locale, []]; + for (let [locale, , , published] of locales) { + if (locale !== req.config.locale && published) { + yield [locale, []]; + } + } + yield ['', []]; + }); + for (let admin of admins) { + admin.avatar = await avatar(req.db, admin); + delete admin.id; + delete admin.email; + + if (adminsGroupped[admin.locale] !== undefined) { + adminsGroupped[admin.locale].push(admin); + } else { + adminsGroupped[''].push(admin); + } + } + + return res.json(adminsGroupped); +}); + +router.get('/admin/list/footer', async (req, res) => { + return res.json(await req.db.all(SQL` + SELECT u.username, p.footerName, p.footerAreas, p.locale + FROM users u + LEFT JOIN profiles p ON p.userId = u.id + WHERE p.locale = ${req.config.locale} + AND p.footerName IS NOT NULL AND p.footerName != '' + AND p.footerAreas IS NOT NULL AND p.footerAreas != '' + ORDER BY RANDOM() + `)); +}); + router.get('/admin/users', async (req, res) => { if (!req.isGranted('users')) { return res.status(401).json({error: 'Unauthorised'}); diff --git a/server/routes/profile.js b/server/routes/profile.js index acb21039..ea695ff8 100644 --- a/server/routes/profile.js +++ b/server/routes/profile.js @@ -47,6 +47,9 @@ const fetchProfiles = async (db, username, self) => { words: JSON.parse(profile.words), avatar: await avatar(db, profile), birthday: self ? profile.birthday : undefined, + teamName: profile.teamName, + footerName: profile.footerName, + footerAreas: profile.footerAreas ? profile.footerAreas.split(',') : [], }; } return p; @@ -64,10 +67,13 @@ router.post('/profile/save', async (req, res) => { } await req.db.get(SQL`DELETE FROM profiles WHERE userId = ${req.user.id} AND locale = ${req.config.locale}`); - await req.db.get(SQL`INSERT INTO profiles (id, userId, locale, names, pronouns, description, birthday, links, flags, words, active) + await req.db.get(SQL`INSERT INTO profiles (id, userId, locale, names, pronouns, description, birthday, links, flags, words, active, teamName, footerName, footerAreas) VALUES (${ulid()}, ${req.user.id}, ${req.config.locale}, ${JSON.stringify(req.body.names)}, ${JSON.stringify(req.body.pronouns)}, ${req.body.description}, ${req.body.birthday || null}, ${JSON.stringify(req.body.links.filter(x => !!x))}, ${JSON.stringify(req.body.flags)}, - ${JSON.stringify(req.body.words)}, 1 + ${JSON.stringify(req.body.words)}, 1, + ${req.isGranted('users') ? req.body.teamName || null : ''}, + ${req.isGranted('users') ? req.body.footerName || null : ''}, + ${req.isGranted('users') ? req.body.footerAreas.join(',').toLowerCase() || null : ''} )`); return res.json(await fetchProfiles(req.db, req.user.username, true)); diff --git a/static/bannerNames.png b/static/bannerNames.png deleted file mode 100644 index ee9461c3..00000000 Binary files a/static/bannerNames.png and /dev/null differ diff --git a/static/bannerNouns.png b/static/bannerNouns.png deleted file mode 100644 index 95ec5374..00000000 Binary files a/static/bannerNouns.png and /dev/null differ diff --git a/static/img/collective-logo.svg b/static/img/collective-logo.svg new file mode 100644 index 00000000..cec1e8a6 --- /dev/null +++ b/static/img/collective-logo.svg @@ -0,0 +1,3 @@ + + +