mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-19 12:36:07 -04:00
(pl)(census) increase privacy by keeping deduplication info separately from answers; fix bug with trimming of translation keys
This commit is contained in:
parent
4a0a58f729
commit
dd92e795e7
@ -20,7 +20,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
key: this.$slots.default[0].text,
|
||||
key: (this.$slots.default[0].text || '').trim(),
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -1711,18 +1711,19 @@ census:
|
||||
Jeśli posługujesz się językiem angielskim, zapraszamy do wypełnienia również i tej ankiety.
|
||||
descriptionOpen:
|
||||
- >
|
||||
Ankieta składa się z <strong>%questions% pytań</strong> i jest otwarta <strong>od %start% do %end%</strong>.
|
||||
Ankieta jest <strong>anonimowa</strong>, składa się z <strong>%questions% pytań</strong>
|
||||
i jest otwarta <strong>od %start% do %end%</strong>.
|
||||
W pytaniach wielokrotnego wyboru <strong>można zaznaczyć wiele odpowiedzi</strong>, jak również <strong>dopisać własne</strong>.
|
||||
By uniknąć tendencyjności, <strong>kolejność propozycji jest losowa</strong>.
|
||||
descriptionClosed: >
|
||||
Następny Spis odbędzie się w <strong>lutym</strong>.
|
||||
agree: >
|
||||
Wyrażam zgodę na przetwarzanie moich odpowiedzi
|
||||
oraz na użycie zanonimizowanej wersji mojego adresu IP oraz fingerprintu przeglądarki
|
||||
oraz na użycie mojego identyfikatora i <em>zanonimizowanej</em> wersji mojego adresu IP oraz fingerprintu przeglądarki
|
||||
do przeciwdziałania wandalizmom i spamowi.
|
||||
Dane te nie są w stanie zidentyfikować żadnej osoby,
|
||||
Dane te nie są w stanie zidentyfikować żadnej osoby, są trzymane osobno od odpowiedzi,
|
||||
zostaną użyte wyłącznie w celu zapewnienia unikalności odpowiedzi
|
||||
i usunięte po zamknięciu spisu.
|
||||
i usunięte niezwłocznie po zamknięciu spisu.
|
||||
start: 'Rozpocznij ankietę'
|
||||
finished: >
|
||||
Dziękujemy za wzięcie udziału w spisie powszechnym!
|
||||
|
15
migrations/077-census-deduplication.sql
Normal file
15
migrations/077-census-deduplication.sql
Normal file
@ -0,0 +1,15 @@
|
||||
-- Up
|
||||
|
||||
CREATE TABLE census_deduplication (
|
||||
locale TEXT NOT NULL,
|
||||
edition TEXT NOT NULL,
|
||||
userId TEXT NULL,
|
||||
fingerprint TEXT NULL
|
||||
);
|
||||
|
||||
INSERT INTO census_deduplication (locale, edition, userId, fingerprint)
|
||||
SELECT locale, edition, userId, fingerprint FROM census WHERE userId IS NOT NULL OR fingerprint IS NOT NULL;
|
||||
|
||||
UPDATE census SET userId = null, fingerprint = null;
|
||||
|
||||
-- Down
|
@ -355,10 +355,13 @@ export default {
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
async mounted() {
|
||||
if (process.client && !this.$user()) {
|
||||
const finishedEdition = window.localStorage.getItem(this.finishedEditionKey) || 0;
|
||||
this.finished = parseInt(finishedEdition) === parseInt(this.$config.census.edition);
|
||||
if (!this.finished) {
|
||||
this.finished = await this.$axios.$get('/census/finished');
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -25,7 +25,7 @@ const buildFingerprint = (req) => sha1(`
|
||||
const hasFinished = async (req) => {
|
||||
if (req.user) {
|
||||
const byUser = await req.db.get(SQL`
|
||||
SELECT * FROM census
|
||||
SELECT * FROM census_deduplication
|
||||
WHERE locale = ${global.config.locale}
|
||||
AND edition = ${global.config.census.edition}
|
||||
AND userId = ${req.user.id}
|
||||
@ -35,7 +35,7 @@ const hasFinished = async (req) => {
|
||||
|
||||
const fingerprint = buildFingerprint(req);
|
||||
const byFingerprint = await req.db.get(SQL`
|
||||
SELECT * FROM census
|
||||
SELECT * FROM census_deduplication
|
||||
WHERE locale = ${global.config.locale}
|
||||
AND edition = ${global.config.census.edition}
|
||||
AND fingerprint = ${fingerprint}
|
||||
@ -86,12 +86,10 @@ router.post('/census/submit', handleErrorAsync(async (req, res) => {
|
||||
const writins = JSON.parse(req.body.writins);
|
||||
|
||||
const id = ulid();
|
||||
await req.db.get(SQL`INSERT INTO census (id, locale, edition, userId, fingerprint, answers, writins, suspicious, relevant, troll) VALUES (
|
||||
await req.db.get(SQL`INSERT INTO census (id, locale, edition, answers, writins, suspicious, relevant, troll) VALUES (
|
||||
${id},
|
||||
${global.config.locale},
|
||||
${global.config.census.edition},
|
||||
${req.user ? req.user.id : null},
|
||||
${buildFingerprint(req)},
|
||||
${req.body.answers},
|
||||
${req.body.writins},
|
||||
${await hasFinished(req)},
|
||||
@ -99,6 +97,13 @@ router.post('/census/submit', handleErrorAsync(async (req, res) => {
|
||||
${boolToInt(isTroll(answers, writins))}
|
||||
)`);
|
||||
|
||||
await req.db.get(SQL`INSERT INTO census_deduplication (locale, edition, userId, fingerprint) VALUES (
|
||||
${global.config.locale},
|
||||
${global.config.census.edition},
|
||||
${req.user ? req.user.id : null},
|
||||
${buildFingerprint(req)}
|
||||
)`);
|
||||
|
||||
await auditLog(req, 'census/submitted_answer');
|
||||
|
||||
return res.json(id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user