Make activated task in hidden project stay hidden

This is an area of the code I haven't touched before, so I'd like feedback before merging this.

I can't think of a really clean way to fix this issue (#1417) without revisions to the states, which I don't want to do for 2.2.3. And the logic for this currently spills into the controller, but I wanted to keep this in the model. So this is what I came up with. Is it an abuse of the state machine or is this an acceptable change?