mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 17:37:49 +02:00
Add closed:keepright changeset tag for closed issues
The issues are written as `schema:error_id` and semicolon delimited e.g. `closed:keepright=56:102661142` closes this issue: https://www.keepright.at/report_map.php?schema=56&error=102661142
This commit is contained in:
@@ -281,7 +281,13 @@ export default {
|
||||
if (_krCache) {
|
||||
_forEach(_krCache.inflight, abortRequest);
|
||||
}
|
||||
_krCache = { loaded: {}, inflight: {}, keepRight: {}, rtree: rbush() };
|
||||
_krCache = {
|
||||
data: {},
|
||||
loaded: {},
|
||||
inflight: {},
|
||||
closed: {},
|
||||
rtree: rbush()
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
@@ -386,7 +392,7 @@ export default {
|
||||
|
||||
d.replacements = tokenReplacements(d);
|
||||
|
||||
_krCache.keepRight[d.id] = d;
|
||||
_krCache.data[d.id] = d;
|
||||
_krCache.rtree.insert(encodeErrorRtree(d));
|
||||
});
|
||||
|
||||
@@ -418,8 +424,14 @@ export default {
|
||||
_krCache.inflight[d.id] = d3_request(url)
|
||||
.post(function(err) {
|
||||
delete _krCache.inflight[d.id];
|
||||
if (d.state === 'ignore' || d.state === 'ignore_t') {
|
||||
|
||||
if (d.state === 'ignore') { // ignore permanently (false positive)
|
||||
that.removeError(d);
|
||||
|
||||
} else if (d.state === 'ignore_t') { // ignore temporarily (error fixed)
|
||||
that.removeError(d);
|
||||
_krCache.closed[d.schema + ':' + d.error_id] = true;
|
||||
|
||||
} else {
|
||||
d = that.replaceError(d.update({
|
||||
comment: d.newComment,
|
||||
@@ -449,7 +461,7 @@ export default {
|
||||
|
||||
// get a single error from the cache
|
||||
getError: function(id) {
|
||||
return _krCache.keepRight[id];
|
||||
return _krCache.data[id];
|
||||
},
|
||||
|
||||
|
||||
@@ -457,7 +469,7 @@ export default {
|
||||
replaceError: function(error) {
|
||||
if (!(error instanceof krError) || !error.id) return;
|
||||
|
||||
_krCache.keepRight[error.id] = error;
|
||||
_krCache.data[error.id] = error;
|
||||
updateRtree(encodeErrorRtree(error), true); // true = replace
|
||||
return error;
|
||||
},
|
||||
@@ -467,13 +479,20 @@ export default {
|
||||
removeError: function(error) {
|
||||
if (!(error instanceof krError) || !error.id) return;
|
||||
|
||||
delete _krCache.keepRight[error.id];
|
||||
delete _krCache.data[error.id];
|
||||
updateRtree(encodeErrorRtree(error), false); // false = remove
|
||||
},
|
||||
|
||||
|
||||
errorURL: function(error) {
|
||||
return _krUrlRoot + 'report_map.php?schema=' + error.schema + '&error=' + error.id;
|
||||
},
|
||||
|
||||
|
||||
// Get an array of errors closed during this session.
|
||||
// Used to populate `closed:keepright` changeset tag
|
||||
getClosedIDs: function() {
|
||||
return Object.keys(_krCache.closed).sort();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
+14
-3
@@ -8,6 +8,7 @@ import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
import { osmChangeset } from '../osm';
|
||||
import { services } from '../services';
|
||||
import { uiChangesetEditor } from './changeset_editor';
|
||||
import { uiCommitChanges } from './commit_changes';
|
||||
import { uiCommitWarnings } from './commit_warnings';
|
||||
@@ -95,8 +96,18 @@ export function uiCommit(context) {
|
||||
|
||||
tags = _clone(_changeset.tags);
|
||||
|
||||
// assign tags for imagery used
|
||||
var imageryUsed = context.history().imageryUsed().join(';').substr(0, 255);
|
||||
tags.imagery_used = imageryUsed || 'None';
|
||||
|
||||
// assign tags for closed issues and notes
|
||||
if (services.keepRight) {
|
||||
var krClosed = services.keepRight.getClosedIDs();
|
||||
if (krClosed.length) {
|
||||
tags['closed:keepright'] = krClosed.join(';').substr(0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
_changeset = _changeset.update({ tags: tags });
|
||||
|
||||
var header = selection.selectAll('.header')
|
||||
@@ -109,17 +120,17 @@ export function uiCommit(context) {
|
||||
headerTitle
|
||||
.append('div')
|
||||
.attr('class', 'header-block header-block-outer');
|
||||
|
||||
|
||||
headerTitle
|
||||
.append('div')
|
||||
.attr('class', 'header-block')
|
||||
.append('h3')
|
||||
.text(t('commit.title'));
|
||||
|
||||
|
||||
headerTitle
|
||||
.append('div')
|
||||
.attr('class', 'header-block header-block-outer header-block-close')
|
||||
.append('button')
|
||||
.append('button')
|
||||
.attr('class', 'close')
|
||||
.on('click', function() { context.enter(modeBrowse(context)); })
|
||||
.call(svgIcon('#iD-icon-close'));
|
||||
|
||||
Reference in New Issue
Block a user