Store changesets_count in a changeset tag

(it will say "0" for someone making their first edit)
This commit is contained in:
Bryan Housel
2017-08-16 16:31:21 -04:00
parent 8cb04a087c
commit 25d8a8aa08

View File

@@ -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 });
}