Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent tasks linking to themselves #5925

Merged
merged 1 commit into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/classifier/tasks/combo/editor.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ComboTaskEditor = createReactClass
<p>
<label>
Next task:{' '}
<NextTaskSelector workflow={@props.workflow} value={@props.task.next} onChange={@setNextTask} />
<NextTaskSelector task={@props.task} workflow={@props.workflow} value={@props.task.next} onChange={@setNextTask} />
</label>
<br />
<span className="form-help">This overrides anything set by a sub-task.</span>
Expand Down
1 change: 1 addition & 0 deletions app/classifier/tasks/dropdown/editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export default class DropdownEditor extends React.Component {
<span className="form-label">Next task</span>
<br />
<NextTaskSelector
task={this.props.task}
workflow={this.props.workflow}
name={`${this.props.taskPrefix}.next`}
value={this.props.task.next || ''}
Expand Down
4 changes: 2 additions & 2 deletions app/classifier/tasks/generic-editor.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module.exports = createReactClass
<div className="workflow-choice-setting">
<AutoSave resource={@props.workflow}>
Next task{' '}
<NextTaskSelector workflow={@props.workflow} name="#{@props.taskPrefix}.#{choicesKey}.#{index}.next" value={choice.next ? ''} onChange={handleChange} />
<NextTaskSelector task={@props.task} workflow={@props.workflow} name="#{@props.taskPrefix}.#{choicesKey}.#{index}.next" value={choice.next ? ''} onChange={handleChange} />
</AutoSave>
</div>

Expand Down Expand Up @@ -266,7 +266,7 @@ module.exports = createReactClass
<div>
<AutoSave resource={@props.workflow}>
Next task{' '}
<NextTaskSelector workflow={@props.workflow} name="#{@props.taskPrefix}.next" value={@props.task.next ? ''} onChange={handleChange} />
<NextTaskSelector task={@props.task} workflow={@props.workflow} name="#{@props.taskPrefix}.next" value={@props.task.next ? ''} onChange={handleChange} />
</AutoSave>
</div>}
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/classifier/tasks/next-task-selector.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = createReactClass
<select name={@props.name} value={@props.value} onChange={@props.onChange}>
<option value="">(Submit classification and load next subject)</option>
{for key, definition of @props.workflow.tasks
unless definition.type is 'shortcut'
unless definition.type is 'shortcut' or definition is @props.task
text = tasks[definition.type]?.getTaskText definition
if text and text.length > MAX_TEXT_LENGTH_IN_MENU
text = text[0...MAX_TEXT_LENGTH_IN_MENU] + '...'
Expand Down
1 change: 1 addition & 0 deletions app/classifier/tasks/slider/editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const SliderTaskEditor = (props) => {
<span className="form-label">Next task</span>
<br />
<NextTaskSelector
task={props.task}
workflow={props.workflow}
name={`${props.taskPrefix}.next`}
value={props.task.next ? props.task.next : ''}
Expand Down
2 changes: 1 addition & 1 deletion app/classifier/tasks/survey/editor.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ module.exports = createReactClass
<AutoSave resource={@props.workflow}>
<span className="form-label">Next task</span>
<br />
<NextTaskSelector workflow={@props.workflow} name="#{@props.taskPrefix}.next" value={@props.task.next ? ''} onChange={handleInputChange.bind @props.workflow} />
<NextTaskSelector task={@props.task} workflow={@props.workflow} name="#{@props.taskPrefix}.next" value={@props.task.next ? ''} onChange={handleInputChange.bind @props.workflow} />
</AutoSave>
</p>

Expand Down
2 changes: 1 addition & 1 deletion app/classifier/tasks/text/editor.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ module.exports = createReactClass
<AutoSave resource={@props.workflow}>
<span className="form-label">Next task</span>
<br />
<NextTaskSelector workflow={@props.workflow} name="#{@props.taskPrefix}.next" value={@props.task.next ? ''} onChange={handleInputChange.bind @props.workflow} />
<NextTaskSelector task={@props.task} workflow={@props.workflow} name="#{@props.taskPrefix}.next" value={@props.task.next ? ''} onChange={handleInputChange.bind @props.workflow} />
</AutoSave>}
</div>