Skip to content

Commit

Permalink
added task property mustache tage replacement for changeset comments …
Browse files Browse the repository at this point in the history
…in rapidEditor
  • Loading branch information
AndrewPhilbin committed Sep 14, 2023
1 parent 148bf02 commit db7c12e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/Widgets/TaskMapWidget/RapidEditor/RapidEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as RapiD from '../../../../../node_modules/RapiD/dist/rapid.legacy.min.
import '../../../../../node_modules/RapiD/dist/rapid.css';
import { UseRouter } from '../../../../hooks/UseRouter/UseRouter.js';
import { constructRapidURI } from '../../../../services/Editor/Editor.js';
import { replacePropertyTags } from '../../../../hooks/UsePropertyReplacement/UsePropertyReplacement.js';
import WithSearch from '../../../HOCs/WithSearch/WithSearch.js';
import { DEFAULT_ZOOM } from '../../../../services/Challenge/ChallengeZoom/ChallengeZoom.js';

Expand Down Expand Up @@ -48,9 +49,15 @@ const RapidEditor = ({

useEffect(() => {
if (RapiDContext && comment) {
RapiDContext.defaultChangesetComment(comment);
const properties = task?.geometries?.features[0]?.properties
if(properties && Object.keys(properties).length) {
const replacedComment = replacePropertyTags(comment, properties, false)
RapiDContext.defaultChangesetComment(replacedComment);
} else {
RapiDContext.defaultChangesetComment(comment);
}
}
}, [comment, RapiDContext]);
}, [comment, RapiDContext, task?.geometries?.features[0]?.properties]);

useEffect(() => {
if (token && locale && RapiD && RapiDContext && task?.id) {
Expand Down

0 comments on commit db7c12e

Please sign in to comment.