Hidden annotations behavior is inconsistent
- Dominant language
- Python
- Stars
- 3.2k
- Forks
- 459
- Avg merge
- 27d 1h
- Merged PRs (30d)
- 1
Description
In this scenario, there are 3 users. A `moderator`, `user1` and `user2`. `user1` has had its annotations flagged and some hidden. There are 2 sets of screen shots to observe. One as a `moderator`, and the other as `user2`.
## As a moderator
There are 2 annotations by `user1`. The top annotation with text "test3" used to have a reply, but by another user. The annotation "test3" was flagged and hidden by a moderator. Later on, the reply by another user was deleted.
As a moderator, I can still see the annotation and I can see its hidden. This is consistent with the comments in annotation_moderation.py:
```
This hides the given annotation from anybody except its author and the
group moderators.
```
_It's worth mentioning that the exactly same behavior will happen if the reply was not deleted._
## Case 1a
- Annotation 1, deleted reply, flagged + hidden
- Annotation 2, no reply, flagged, not hidden

### Behavior
**Expected behavior:** Both annotations should be returned in the API call , one set to hidden and one not.
**Actual behavior:** This is correct and what is expected.
## Case 2a
- Annotation 1, deleted reply, flagged + hidden
- Annotation 2, no reply, flagged + hidden
However, observe the second screen shot. Here we have just an annotation, again by `user1`, which never had a reply. This annotation is flagged and hidden, but when I refresh the page as a moderator, I no longer see the annotation in the response. I believe this is inconsistent with the comment in annotation_moderation.py.

### Behavior
**Expected behavior:** Both annotations should be returned in the API call with hidden set to true
**Actual behavior:** Only the top annotation is returned with hidden set to true, the other is missing.
## As `user2`
### Case 1b
- Annotation 1, deleted reply, flagged + hidden
- Annotation 2, no reply, flagged, not hidden
Next, if I'm not a moderator and a different, say user (`user2`), similar behavior occurs. In the first case, the top annotation is hidden, but we still see it. Note this annotation, had a reply, but was deleted after it was hidden. We can see this annotation comes from /h, and its values "hidden" is true, "flagged" is false and its "text" is omitted (appropriately) . I believe this is consistent with other hidden annotations that have replies, however; in this case it no longer has any replies. The fact this annotation comes back from the search in this case seems incorrect.

### Behavior
**Expected behavior:** The top annotation (Annotation 1) should not be returned in the API search call
**Actual behavior:** Both annotations are returned
## Case 2b
- Annotation 1, deleted reply, flagged + hidden
- Annotation 2, no reply, flagged + hidden
In this second screen shot, The last annotation was hidden by the moderator, and we can clearly see that the annotation is hidden from `user2` as expected. This annotation never had any replies.

### Behavior
**Expected behavior:** No annotations should return in the API search call.
**Actual behavior:** The top annotation is returned
Relates to https://github.com/hypothesis/support/issues/193
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.