apostrophecms / apostrophecms/apostrophe

[Apostrophe versions] authorId and author fields is null for aposDocVersions

Open
#2,243 9 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
4.6k
Forks
650
Avg merge
19h 21m
Merged PRs (30d)
23

Description

## To Reproduce

Step by step instructions to reproduce the behavior:

> 1. Download and install the Apostrophe Open Museum project from:
https://github.com/apostrophecms/apostrophe-open-museum

> 2. Add various content types from the back end modal using the open museum project.

> 3. Edit any content type and click on More/Versions:

> 4. Few versions are missing the user title and instead of displaying the message: _ admin made changes on DD/MM/YYYY_ it display as: _made changes on DD/MM/YYYY_

## Expected behavior

The user title should always be displayed for each content type in the versions modal as only logged in users should be allowed to edit and make changes to the back end content using the modal

## Describe the bug

The `authorId` and `author` fields are not always saved as the current logged in user and in many instances they are instead saved as `null` in the `aposDocVersions` collection for many documents:

![image](https://user-images.githubusercontent.com/39920614/87351421-678e5900-c527-11ea-9251-1ce35e7569a8.png)

## Details

**Version of Node.js:**
v12.14.0

**Server Operating System:**
Linux (Ubuntu 18x) while no Docker is installed

**Additional context:**

The same issue can be replicated across different browsers and different devices (OS)

**Screenshots**

![image](https://user-images.githubusercontent.com/39920614/87348394-a53cb300-c522-11ea-88f9-9f75a6cf3dc1.png)

**Mongo DB Dump**

This DB dump shows all `aposDocVersions` documents where the `authorId `and `author` fields `is null` for out of the box Git Hub Apostrophe boiler plate installation and no extra configuration. So far there are about 20 reported entries while in some other Prod sites the number of `authorId `and `author` fields `null` records can reach +200k entries.

Also this dump has more recent entries than the one showed in the screen shot.

Attached:

[mongodb.zip](https://github.com/apostrophecms/apostrophe/files/4915019/mongodb.zip)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the Apostrophe Open Museum project and inspect how entries are written to the aposDocVersions collection during edits and version creation. Confirm the affected records consistently retain the logged-in user's authorId and author so the versions modal displays the user title for every version.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, nodejs
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.