Currently, when one clicks Changes
for a ToDo list, it raises an error. The Changes
view shows a logged-in user what has been updated, but clicking on a completed task brings up an error:
Unable to open 'Complete' in the current context
This should do something else. If a task is opened and a user clicks changes, it displays the editor on that task.
This is due to the following code:
PRCompleteToDoTaskCommand(class)>>isValidIn: ^ (super isValidIn: aContext) and: [ aContext structure isRoot not and: [ aContext structure parent isToDo ] ]
One reason the code is written this way is so the Complete
option only shows up on the menu when a task is open - it doesn't make sense to "complete" the Syntax page. The menu is the gray text at the bottom of this page, or in the left pane of the default install:
isValidIn: aContext ^ (super isValidIn: aContext) and: [ aContext command class = self or: [ aContext command isView and: [ aContext command viewComponentClass isNotNil and: [ aContext command viewComponentClass = PRChangesView ] ] ] ]
The scenarios that this handles are:
Complete
menu option should not show upComplete
menu option is only available when viewing a complete history item, it opens the normal pier page editorThe tests for equality make adding a subclass of PRCompleteToDoTaskCommand more difficult than necessary, but this code is sufficient to create a non-abstract test. This allows adding:
PRCommand>>shouldBeIncludedInCompleteHistory ^ false PRViewCommand>>shouldBeIncludedInCompleteHistory ^ self viewComponentClass isNotNil and: [ self viewComponentClass = PRChangesView ] PRCompleteToDoTaskCommand>>shouldBeIncludedInCompleteHistory ^ true
Then #isValidIn:
can ask aContext's command if it should be displayed instead of performing checks itself.