Creation meta is now omitted when no user present

This commit is contained in:
Rainer Simon 2020-05-18 09:42:55 +02:00
parent b20ff30433
commit 9e4f0bd3f3
1 changed files with 7 additions and 4 deletions

View File

@ -68,10 +68,13 @@ const Editor = props => {
const creationMeta = body => {
const meta = {};
// No point in adding meta while we're in draft state
if (!body.draft) {
const { user } = Environment;
if (user) meta.creator = {};
const { user } = Environment;
// Metadata is only added when a user is set, otherwise
// the Editor operates in 'anonymous mode'. Also,
// no point in adding meta while we're in draft state
if (!body.draft && user) {
meta.creator = {};
if (user.id) meta.creator.id = user.id;
if (user.displayName) meta.creator.name = user.displayName;