Skip to content

Commit

Permalink
Fix "Unique visitor count and anonymisation (#304)"
Browse files Browse the repository at this point in the history
  • Loading branch information
electerious committed Jan 15, 2022
1 parent 7f8f5fa commit 51491cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

- MongoDB 4.4 or newer is now required, but older versions still may work

### Fixed

- Unique visitor count and anonymisation (#304)

## [3.3.0] - 2021-12-04

### Added
Expand Down
30 changes: 15 additions & 15 deletions src/database/records.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ const update = async (id) => {
)
}

const anonymize = async (clientId, ignoreId) => {
const anonymize = (clientId, ignoreId) => {
// Don't return anything about the update
await Record.updateMany({
return Record.updateMany({
$and: [
{ clientId },
{
Expand All @@ -81,19 +81,19 @@ const anonymize = async (clientId, ignoreId) => {
},
],
}, {
clientId: undefined,
siteLanguage: undefined,
screenWidth: undefined,
screenHeight: undefined,
screenColorDepth: undefined,
deviceName: undefined,
deviceManufacturer: undefined,
osName: undefined,
osVersion: undefined,
browserName: undefined,
browserVersion: undefined,
browserWidth: undefined,
browserHeight: undefined,
clientId: null,
siteLanguage: null,
screenWidth: null,
screenHeight: null,
screenColorDepth: null,
deviceName: null,
deviceManufacturer: null,
osName: null,
osVersion: null,
browserName: null,
browserVersion: null,
browserWidth: null,
browserHeight: null,
})
}

Expand Down

0 comments on commit 51491cc

Please sign in to comment.