Item5897: If COMMENT specifies target and target is missing, content disappears
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
If COMMENT specifies a target, e.g.
%COMMENT{type="logbook" templatetopic="VickiCommentTemplate" target="%WEB%.%INCLUDINGTOPIC%#AnchorHere"}%
and the target (
#AnchorHere
) is
not found
COMMENT will discard the results.
Instead of making the data disappear, COMMENT should default to whatever behaviour it would have expressed without a specified "target" parameter - e.g. put the content BEFORE or AFTER the comment box.
Sample Template
%TMPL:DEF{PROMPT:testpost}%
<table valign="top">
<tr>
<td>
<textarea %DISABLED% rows="10" cols="80" name="testpost_summary" wrap="soft"></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Test Post" />
</td>
</tr>
</table>%TMPL:END%
%TMPL:DEF{OUTPUT:testpost}%
%POS:AFTER%
%URLPARAM{"testpost_summary"}%
-- %WIKIUSERNAME% %DATE%
---
%TMPL:END%
--
TWiki:Main/VickiBrown - 07 Aug 2008
Hmmm, that's a tough call. Some would say it should generate an alert, otherwise it will appear that the comment plugin is stuffing comments where they aren't wanted. Imagine if the target is another topic, and you don't have write permission in the current topic (a typical pattern). The comment plugin would fail reporting that access was denied on the topic that isn't the target; very confusing!
Confirmed and reclassified as enhancement.
--
CrawfordCurrie - 08 Aug 2008
If the target is in a topic where you don't have authorization, I agree an alert is appropriate.
If the target is missing, perhaps COMMENT could act like
INCLUDE and notice and put up a red warning that the target doesn't exist.
But in either case, causing everything you typed to disappear is inappropriate. COMMENT plugin is used for so much more than "commentary". In this case, we're creating Runbooks. When the engineer spends time typing in an instruction and it just disappears when he click submit, that's wrong.
I'm much more concerned by the disappearance of the content. The implementation details don't worry me much. (Preventing data loss is a bug fix, not an enhancement.)
I suspect I fixed this when I worked on Timothe's fix, i'll have to look :/
--
SvenDowideit - 08 Feb 2009
In my testing for unrelated stuff, it appears that
CommentPlugin will create the target if it's missing. I didn't test what happens if the create is not permitted.
--
GeorgeClark - 14 Jan 2012
Trunk version of
CommentPlugin causes a crash if ASSERTs are enabled, and user attempts to create a missing topic in web that the user cannot modify. With ASSERT disabled, the user gets an OOPS failure for the access exception.
Task11443
This is fixed by the trunk version of the
CommentPlugin. The REST handler version of the plugin can handle creating a target topic if missing.
--
GeorgeClark - 14 Oct 2012