diff --git a/modules/ui/commit.js b/modules/ui/commit.js index aaab49f4c..0e5ffc75d 100644 --- a/modules/ui/commit.js +++ b/modules/ui/commit.js @@ -11,11 +11,18 @@ import { utilRebind } from '../util'; var changeset; -var readOnlyTags = ['created_by', 'imagery_used', 'host', 'locale']; +var readOnlyTags = [ + 'changesets_count', + 'created_by', + 'imagery_used', + 'host', + 'locale' +]; export function uiCommit(context) { var dispatch = d3.dispatch('cancel', 'save'), + userDetails, _selection; var changesetEditor = uiChangesetEditor(context) @@ -122,6 +129,8 @@ export function uiCommit(context) { var userLink = d3.select(document.createElement('div')); + userDetails = user; + if (user.image_url) { userLink .append('img') @@ -323,6 +332,13 @@ export function uiCommit(context) { } } + // always update userdetails, just in case user reauthenticates as someone else + if (userDetails && userDetails.changesets_count !== undefined) { + tags.changesets_count = String(userDetails.changesets_count); + } else { + delete tags.changesets_count; + } + if (!_.isEqual(changeset.tags, tags)) { changeset = changeset.update({ tags: tags }); }