Skip to content

Commit

Permalink
Merge pull request #1261 from osmlab/prerelease
Browse files Browse the repository at this point in the history
v3.6.3
  • Loading branch information
nrotstan authored Jun 8, 2020
2 parents 587d7cb + d0e2117 commit 481c9f8
Show file tree
Hide file tree
Showing 78 changed files with 2,023 additions and 161 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ This project adheres to
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [v3.6.3] - 2020-06-08
### Added
- Following of other users' MapRoulette activity
- Refreshed home page
- Teams page
- Notification when invited to join a Team
- Task prioritization by location for challenge managers

### Fixed
- Review page search boxes not allowing case-insensitive search
- Erroneous security errors immediately following creation of new project
- Long challenge names not wrapping properly in Challenge Highlights widget


## [v3.6.2] - 2020-05-28
### Added
- Revised Dashboard page
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maproulette3",
"version": "3.6.2",
"version": "3.6.3",
"private": true,
"dependencies": {
"@apollo/client": "^3.0.0-beta.44",
Expand Down
2 changes: 2 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import AdminPane from './components/AdminPane/AdminPane'
import InspectTask from './components/AdminPane/Manage/InspectTask/InspectTask'
import Review from './pages/Review/Review'
import Inbox from './pages/Inbox/Inbox'
import Teams from './pages/Teams/Teams'
import PageNotFound from './components/PageNotFound/PageNotFound'
import { resetCache } from './services/Server/RequestCache'
import WithCurrentUser from './components/HOCs/WithCurrentUser/WithCurrentUser'
Expand Down Expand Up @@ -109,6 +110,7 @@ export class App extends Component {
<CachedRoute exact path='/review/:showType' component={Review} />
<CachedRoute path='/review' component={Review} />
<CachedRoute path='/inbox' component={Inbox} />
<CachedRoute path='/teams' component={Teams} />
<CachedRoute path='/challenge/:challengeId/leaderboard' component={ChallengeLeaderboard} />
<CachedRoute path='/project/:projectId/leaderboard' component={ProjectLeaderboard} />
<CachedRoute path='/country/:countryCode/leaderboard' component={CountryLeaderboard} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const mapStateToProps = state => ({
entities: state.entities
})

const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch, ownProps) => {
const actions = bindActionCreators({
fetchManageableProjects,
fetchProject,
Expand All @@ -142,7 +142,7 @@ const mapDispatchToProps = dispatch => {

actions.toggleProjectEnabled = project => {
const updatedProject = Object.assign({}, project, {enabled: !project.enabled})
return dispatch(saveProject(updatedProject))
return dispatch(saveProject(updatedProject, ownProps.user))
}

return actions
Expand Down
2 changes: 1 addition & 1 deletion src/components/AdminPane/Manage/EditProject/EditProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class EditProject extends Component {
formData.name = _snakeCase(formData.displayName).replace(/^home_/, 'project_')
}

this.props.saveProject(formData).then(project => {
this.props.saveProject(formData, this.props.user).then(project => {
if (project) {
this.props.history.push(`/admin/project/${project.id}`)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import _difference from 'lodash/difference'
import _get from 'lodash/get'
import _remove from 'lodash/remove'
import _isEqual from 'lodash/isEqual'
import _merge from 'lodash/merge'
import { FormattedMessage, injectIntl } from 'react-intl'
import { Link } from 'react-router-dom'
import External from '../../../../External/External'
Expand All @@ -24,11 +25,14 @@ import StepNavigation
from '../../StepNavigation/StepNavigation'
import { CustomArrayFieldTemplate,
CustomSelectWidget,
CustomTextWidget,
MarkdownDescriptionField,
MarkdownEditField }
from '../../../../Bulma/RJSFFormFieldAdapter/RJSFFormFieldAdapter'
import KeywordAutosuggestInput
from '../../../../KeywordAutosuggestInput/KeywordAutosuggestInput'
import BoundsSelectorModal
from '../../../../BoundsSelectorModal/BoundsSelectorModal'
import WithCurrentProject
from '../../../HOCs/WithCurrentProject/WithCurrentProject'
import WithCurrentChallenge
Expand Down Expand Up @@ -655,14 +659,17 @@ export class EditChallenge extends Component {
className="form"
onAsyncValidate={this.validateGeoJSONSource}
uiSchema={currentStep.uiSchema(this.props.intl, this.props.user, challengeData)}
widgets={{SelectWidget: CustomSelectWidget}}
widgets={{SelectWidget: CustomSelectWidget, TextWidget: CustomTextWidget}}
ArrayFieldTemplate={CustomArrayFieldTemplate}
fields={customFields}
tagType={"challenges"}
noHtml5Validate
showErrorList={false}
formData={challengeData}
formContext={this.state.formContext}
formContext={_merge(this.state.formContext,
{bounding: _get(challengeData, 'bounding'),
buttonAction: BoundsSelectorModal,
})}
onChange={this.changeHandler}
onSubmit={this.asyncSubmit}
onError={this.errorHandler}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,17 @@ export const normalizeRuleForSaving = (rule, allowCSV=true) => {
return normalizeRuleGroupForSaving(rule.ruleGroup)
}

if (rule.valueType === "bounds") {
rule.key = "location"
}

if (_isEmpty(rule.key)) {
return null
}

// If there are multiple, comma-separated values, split into separate rules
// (ignoring commas in quoted strings)
if (allowCSV && /,/.test(rule.value)) {
if (allowCSV && /,/.test(rule.value) && rule.valueType !== "bounds") {
let condition = "OR"

// Negative conditions need to be "AND" (eg. value not 1 AND not 2)
Expand All @@ -140,6 +144,9 @@ export const normalizeRuleForSaving = (rule, allowCSV=true) => {
if (rule.valueType === "string") {
rule.operator = "equal" // default string operator
}
else if (rule.valueType === "bounds") {
rule.operator = "contains" // default bounds operator
}
else {
rule.operator = "==" // default numeric operator
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export const jsSchema = intl => {
valueType: {
title: "Property Type",
type: "string",
enum: ["string", "integer", "double", "long", "nested rule"],
enum: ["string", "integer", "double", "long", "nested rule", "bounds"],
enumNames: ["string", "integer", "double", "long", "nested rule", "location rule"],
},
},
required: [ "valueType" ],
Expand Down Expand Up @@ -97,6 +98,25 @@ export const jsSchema = intl => {
type: "string",
},
},
},
{ // bounds values
properties: {
valueType: {
enum: ["bounds"],
},
operator: {
title: "Operator",
type: "string",
enum: ["contains", "not_contains"],
enumNames: ["inside bounds", "outside bounds"],
default: "inside bounds",
},
value: {
title: "Bounds Value",
type: "string",
withButton: "map"
},
},
}
]
}
Expand Down
39 changes: 39 additions & 0 deletions src/components/AreaSelect/AreaSelect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import L from 'leaflet'
import './leaflet-areaselect'
import { injectIntl } from 'react-intl'
import { MapControl, withLeaflet } from 'react-leaflet'

/**
* Leaflet AreaSelect that allows selection of a bounding box.
*
* Note: An object passed to the constructor will be available as `this.options`
*
* Code provided by: https://github.com/heyman/leaflet-areaselect/
*/
const AreaSelectLeaflet = L.Control.extend({
onAdd: function(map) {
const areaSelect = L.areaSelect({width:200, height:300});
areaSelect.addTo(map)

// Send a callback when the bounds change
areaSelect.on("change", () => {
this.options.onBoundsChanged(areaSelect.getBounds())
})

return L.DomUtil.create('div')
}})


/**
* AreaSelect is a react-leaflet component intended to be
* used as a child of a react-leaflet Map instance, such as EnhancedMap. When
* clicked, the control activates
*/
export class AreaSelect extends MapControl {
// props will be available as `options` field in the leaflet control
createLeafletElement(props) {
return new AreaSelectLeaflet(props)
}
}

export default withLeaflet(injectIntl(AreaSelect))
Loading

0 comments on commit 481c9f8

Please sign in to comment.