hypothesis / product-backlog

Where new feature ideas and current bugs for the Hypothesis product live
118 stars 7 forks source link

Show replies in activity pages, and link to stream #378

Closed judell closed 6 years ago

judell commented 6 years ago

Problem: Users are frequently confused when viewing search results, and user/group pages, because cards only display toplevel annotations, not replies.

Ultimate solution: Complete the rewrite of the client-side thread display for the server-side-based activity pages module.

Interim solution: Leverage the stream.

It's easy for the server to know if replies exist (and how many), to make that knowledge available in the context of an AP card. and to use it to link to a standalone stream page that displays replies and supports interaction with the thread.

Example: http://jonudell.net/h/simple-replies-in-activity-pages.mp4

Code behind example: https://github.com/hypothesis/h/compare/ap-replies

robertknight commented 6 years ago

Hi @judell

Do you have links to some of the support requests that this relates to? I know the need seems quite obvious but it is very useful to collect the wider context if available.

The feature as shown in the video looks like it might be a pragmatic solution if we only had a short time to work on this.

The implementation is quite short but I see a couple of potential problems, which are connected to each other. As I understand it, the current A.P. search fetches annotations and filters out replies in the ElasticSearch query, then groups the annotations into buckets by update time + document URI. The code in this PR removes the reply filter and calculates reply counts in the Python code. This means:

  1. The total number of annotations shown on each search results page will now vary, depending on how many replies are fetched.
  2. This doesn't guarantee to fetch every reply to a given top-level annotation does it?

If I understand correctly, in theory it is possible that the search fetches say 3 pages like this:

A1
A2
R1 (Reply to A3)
---
R2 (Reply to A3)
A3
A4
---
R3 (Reply to A3)
A5
A6

Where A3 is an annotation that has 3 replies, of which two were updated after A3 was last updated and one of which was written before A3 was last updated (but obviously after A3 was initially created). The reply count will show as 1 when it should be 3 because the Python code only calculates the reply count looking at each page at a time.

It is possible that (1) doesn't really matter and that (2) occurs infrequently enough that we can look the other way and ignore it without users bumping into it often, but we should still be aware of the issue.

judell commented 6 years ago

This doesn't guarantee to fetch every reply to a given top-level annotation does it?

Excellent point. I did notice that our current AP leaves _separate_replies turned off. I'll take a look at the implications of turning it on, and see how that goes. Might cause a different problem, but easy to check, and worth checking.

Thanks!

judell commented 6 years ago

I've asked @jeremydean to chime in with anecdotal reports, of which there are many.

It comes down to very simple thing, though. If you are participating in a conversation on a document, and then search for that conversation on the H website, or look for it on a group page, or your user page, you will not find it. And you will worry that data has been lost. Which in a sense it has been, since we are literally telling Elasticsearch to suppress it.

judell commented 6 years ago

For the implementation shown above, on a test server with the search page_size limited to 20, we have this result:

image

And if page_size is 10, this result:

image

Because the 10 replies to the Self-Sovereign Identity article push their referent out of the results. So yeah, that's not good.

If instead we do it this way, https://github.com/hypothesis/h/compare/ap-separate-replies, using separate_replies=True for the search, then

For page_size of 20:

image

For a page_size of 10:

image

jeremydean commented 6 years ago

Here's some of the "wilder context" you asked for @robertknight:

https://docs.google.com/a/hypothes.is/document/d/1AP5jdmp4TTENTPiAS7TI4iLTofzAx9VgjBzyCDLLZXU/edit?usp=sharing

klemay commented 6 years ago

Another user request for this feature: https://hypothesis.zendesk.com/agent/tickets/1961

robertknight commented 6 years ago

The technical approach taken here has a bunch of problems I described in the second comment. However we do index the IDs of all replies along with other metadata when indexing annotations for search which could be used instead.

For future reference, I have a proof of concept using this at https://github.com/hypothesis/h/compare/master...robertknight:reply-count-badge . I found at least one issue we'd have to fix where the counts currently don't get updated when deleting replies.

judell commented 6 years ago

Much nicer, thanks!

klemay commented 6 years ago

Here is a use case from an instructor of a course on archaeological methods and theory:

I use a private group to collectively annotate a PDF that is publicly available on line (the Corinth Site Manual, published by the Digital Press of North Dakota). The students annotate the same long document repeatedly over the course of semester, as a series of weekly assignments, each of which receives a separate score. I encourage them to reply to each other's annotations, and I try to reply to their questions as well. I tend to grade the annotations in batches, rather than week by week. Some of the observations, questions, and conversations are actually really interesting, and would add value to the document. In addition, I encourage the students to find actual examples of the items or phenomena described in the text in a public database associated with the same archaeological project and to link to those records. Not all of the annotations are great, however.

Here's what I'd like to be able to do:

1) See all annotations AND replies posted by an individual student at once (right now I have to look through the entire document to find replies when I'm grading an individual student);

2) Sort those annotations and replies ascending or descending by date (these two features would make it easier to manage grading);

3) Ideally, do this all in the Hypothesis sidebar for the document itself, rather than in my group page in the main site. It would be easier to grade if I could see what the students were marking up without having to click out to the original context, and it would make it a lot easier for me to reply to them (since I can't reply to posts when I view them in the group page on the main site);

klemay commented 6 years ago

Closing in favor of: https://github.com/hypothesis/product-backlog/issues/689

judell commented 6 years ago

/cc @dwolfe

Re: http://jonudell.net/h/simple-replies-in-activity-pages.mp4, which links out to the standalone client view, see also http://jonudell.info/h/replies-in-ap-pages.mp4 which activates the client view inline.

Neither is entirely satisfactory. But the former approach, more specifically https://github.com/hypothesis/h/compare/master...robertknight:reply-count-badge, could be a workable interim fix.