PubPeerFoundation / pubpeer_zotero_plugin

Plugin to show if references in Zotero have PubPeer comments
149 stars 2 forks source link

Configure commenters in PubPeer pane #7

Closed borisbarbour closed 4 years ago

borisbarbour commented 4 years ago

Could the information in the PubPeer pane could be made richer?

1) Reorder the information a bit:

2) The tags would be:

3) The tagging would have the following effects on the central pane:

Alternatively, we could leave the current icon for the neutral cases and invent a new highlighted one for the priority case. The number of comments in the central pane column could remain unchanged.

A mock up of the PubPeer pane is as follows: image

retorquere commented 4 years ago

I don't quite follow. In the mock above, does "retinal outputs..." get the highlighted icon because at least one of the commenters has a check mark? So icon assignment would be:

  1. If there is at least one checkmarked-commenter, you get the highlighted icon
  2. If there is not a checkmarked-commenter, but there is a blank-commenter, you get the subdued icon
  3. If all commenters are muted-commenters, no icon

Note that this is not merely a reshuffling of stuff in the pubpeer pane. The information entered here needs to survive restarts, and the injected pane has to be made responsive to user input; each of those bumps it up an order of complexity. It can be done (my own plugins also have persistent storage, so I know how to do this), but I want the behavior to be specced out clearly before I start.

retorquere commented 4 years ago

Also in the mock above: how would an entry have 0 comments? Wouldn't a DOI need to have at least one comment to show up at all?

retorquere commented 4 years ago

Wait -- the pubpeer count in the middle column would now only be the number of checked-commenters? That stands in direct contrast to

The number of comments in the central pane column could remain unchanged.

Also, what would be the default for newly fetched items?

This is really not a trivial change being proposed here. Again, it can be done, but this really is substantially more work than the earlier stuff.

borisbarbour commented 4 years ago

Your reading of the logic of checkmarks and icons is correct.

The 0 comments is inherited from the API (I didn't alter that). Some types of comment are not reported in the count, in particular those made automatically by a program called Statcheck. This also applies to comments mirrored from PubMed Commons. It can also happen if a comment is moderated publically. I don't think there is any need to change the number of comments reported by the API, just the icons.

For new commenters, the default would be blank/neutral. I guess whenever things get scanned/updated, the commenters in each paper should be checked and icons enabled accordingly? Note that some commenters appear in many discussions and the muting/prioritisation is supposed to apply to all of their comments and other papers on which they have commented. This indeed implies maintaining a persistent commenter list, at least for those that are muted or prioritised (I think, I'm not trying to impose a particular implementation).

retorquere commented 4 years ago

When you say

For new commenters

how would I detect that it's a new commenter? That information isn't present in the API results. Or is that just "a commenter not seen before in previous fetches"? Not sure how to interpret "commenters" here. A commenter is a person? If so:

Note that some commenters appear in many discussions and the muting/prioritisation is supposed to apply to all of their comments

So commenters would have unique names in the API output?

On another note, is pubpeer down? I'm currently getting

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>shield</center>
</body>
</html>
borisbarbour commented 4 years ago

Commenters use their real names or a pseudonym (assigned to them from the tree of life); the latter is sometimes used to make multiple comments on different papers. For our purposes, commenter=name returned by API. I did just mean "new" in the sense of "one that the user's zotero had not fetched before".

PubPeer does seem to be down at the moment.

retorquere commented 4 years ago

While again, possible, it adds to the complexity. Doable, and I had something in mind, but not trivial. Usually I'd stick this in a sqlite database (which is what Zotero uses) and be done with it, but database access is async, and the monkey-patched bits that put the text and the icons up are not. Putting stuff in the database has the downside that we'd have to deal with schema migration if we change our minds about what goes into the database. And the middle table really doesn't expect async responses to its requests for text/style. That could lead to a cascade of promises. Hmm. It's all not hard to do, just a lot to figure out. I could go the way BBT does it, but that's pretty complex in itself. I'll have to think about this for a bit to let it crystallize.

In any case: this would mean that if I toggle the status of a commenter in one place, it would change everywhere, yeah? That strikes me as unintuitive UX.

borisbarbour commented 4 years ago

"In any case: this would mean that if I toggle the status of a commenter in one place, it would change everywhere, yeah? That strikes me as unintuitive UX."

It would be what I would want as a user. If you have to go through every paper to disable each commenter you don't like, there is really no gain. I think the alternative would be to have a separate list of user names, but that would add another configuration dialog. And it would be less natural - with the current design, you would just have read a comment (by clicking on the link) and you could decide there and then that you really like (or dislike) the commenter. I don't think a distinct configuration interface would get much use at all. First off, you would have to discover it, which most people wouldn't. Etc.

retorquere commented 4 years ago

What a good night's sleep won't do. I have a simpler solution for storing the data. I won't be able to work on it today, but bits and pieces will likely emerge next week.

brandonStell commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.5.20 ("user marking")

Install in Zotero by downloading test build 0.0.5.20, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 4 years ago

On the first day of christmas, mozilla left to me, undocumented CSS tricks to fiddle with styling (I am better at coding than rhyming)

.20 adds the user marking. It doesn't look exactly as nicely as I want yet; the standard checkbox in firefox doesn't do tri-state, and the button-checkbox that does do tri-state has a border I haven't been able to remove in hours of scouring the internet.

Problem with all of this is that it's built in XUL, which Mozilla chucks under the "Archive of obsolete content". There's hardly any docs, and hardly any active users, so I have to cobble stuff together from the crumbling ruins of the Firefox documentations, and ancient forum posts.

The behavior is OK as far as I can tell.

brandonStell commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.5.21 ("fake checkbox")

Install in Zotero by downloading test build 0.0.5.21, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 4 years ago

In the end I've just made fake checkboxes from labels. I wasn't getting anywhere with the actual buttons. I think this looks pretty OK.

retorquere commented 4 years ago

As an aside, it seems a bit iffy to me TBH that the API gives back commenters as one comma-separated string rather than simply a JSON array.

borisbarbour commented 4 years ago

Apologies for slow testing.

The layout is exactly as planned hoped. Thanks.

I noticed two issues. 1) the PubPeer pane is only updated when visiting entries that have comments. If you examine the pane for an entry with comments then go to another without, the PubPeer information from the last-viewed entry with comments persists. 2) I don't perceive any changes of the alert icon in response to the checkbox status of the (single) commenter.

retorquere commented 4 years ago

I didn't know you wanted the icon in the middle table to change. That's not trivial, but I'll look into it.

borisbarbour commented 4 years ago

From above (https://github.com/PubPeerFoundation/pubpeer_zotero_plugin/issues/7#issuecomment-562833067)

  1. If there is at least one checkmarked-commenter, you get the highlighted icon
  2. If there is not a checkmarked-commenter, but there is a blank-commenter, you get the subdued icon
  3. If all commenters are muted-commenters, no icon

In the above, the "icon" was intended to be that in the middle pane. Apologies if that wasn't clear.

retorquere commented 4 years ago

No, that should have been clear to me. I'll see what I can do.

retorquere commented 4 years ago

Where can I find those icons again?

retorquere commented 4 years ago

I've taken them from #1 for now, but the green-on-white middle icon is 33x33 rather than 32x32

retorquere commented 4 years ago

~Do you want the number of commenters in the middle pane to include or exclude the muted commenters?~

The middle pane shows number of comments, not the number of commenters. So the question is then: if all commenters are muted, should I still show total_comments, but without an icon? Or nothing?

brandonStell commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.5.23 ("clear out commenters on item switch, update middle icon")

Install in Zotero by downloading test build 0.0.5.23, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

borisbarbour commented 4 years ago

The numbers can remain unchanged.

On Tue, Jan 7, 2020 at 11:30 PM Emiliano Heyns notifications@github.com wrote:

Do you want the number of commenters in the middle pane to include or exclude the muted commenters?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PubPeerFoundation/pubpeer_zotero_plugin/issues/7?email_source=notifications&email_token=ABCZPNWTY5HEZGSB23FMWJLQ4T667A5CNFSM4JXEWHL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIKQL5Q#issuecomment-571803126, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCZPNU6322KRCROS3XHMH3Q4T667ANCNFSM4JXEWHLQ .

--

Boris Barbour The PubPeer Foundation

Article 5. No one shall be subjected to torture or to cruel, inhuman or degrading treatment or punishment.

borisbarbour commented 4 years ago

0.0.5.23 is almost perfect as far as I'm concerned. There is just one final thing that I forgot. In the PubPeer pane, the first bit of the text "8 PubPeer comments by: Boris Barbour, James Dean, etc" is now mostly redundant with the commenter list alongside the check boxes. I suggest simply removing the unstructured list of names, leaving only the statement about the number of comments. Thus:

8 PubPeer comments. https://pubpeer.com/publications.... Most recent comment... checkbox/name list...

retorquere commented 4 years ago

This build still throws TypeError: can't access dead object. I'm looking into it.

brandonStell commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.5.24 ("use global singleton")

Install in Zotero by downloading test build 0.0.5.24, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 4 years ago

The error is gone, and the names are removed. The strings are translatable BTW -- if you want I can add it as a project on Crowdin (which is free for open source projects) so people can volunteer translations. It will take me a few hours to do so however, Crowdin setup is a little non-intuitive, but once going it's pretty easy to use for volunteers.

borisbarbour commented 4 years ago

Great! I'll make a final check this evening. Honestly, I don't think that translation is at all necessary - 99.999% of scientific publications are in English, as is 100% of commentary on PubPeer, so I think we can assume that interested readers will be able to read an English PubPeer pane...

On Wed, Jan 8, 2020 at 10:51 AM Emiliano Heyns notifications@github.com wrote:

The error is gone, and the names are removed. The strings are translatable BTW -- if you want I can add it as a project on Crowdin (which is free for open source projects) so people can volunteer translations. It will take me a few hours to do so however, Crowdin setup is a little non-intuitive, but once going it's pretty easy to use for volunteers.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/PubPeerFoundation/pubpeer_zotero_plugin/issues/7?email_source=notifications&email_token=ABCZPNUQF32AJN5UESSC5CLQ4WOZZA5CNFSM4JXEWHL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEILZ3EA#issuecomment-571973008, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCZPNXQAOQ437GYNCCQPFTQ4WOZZANCNFSM4JXEWHLQ .

--

Boris Barbour The PubPeer Foundation

Article 5. No one shall be subjected to torture or to cruel, inhuman or degrading treatment or punishment.

retorquere commented 4 years ago

That's OK, I just wanted you guys to know that it's set up for it, it just comes with the tech Zotero uses for plugins.

borisbarbour commented 4 years ago

I'm really sorry - I noticed one final, minor niggle. When there is no icon, the number changes position. Maybe insert a black image (or space) or the same size where the icon would be, to keep the numbers aligned in their part of the column?

Otherwise: perfect. Thank you!

retorquere commented 4 years ago

NP. Is there an SVG version of the pubpeer logo? I've tried to copy the SVG from the pubpeer site but it seems faint to the point of being solid white.

retorquere commented 4 years ago

Also: the neutral icon has a white background, not transparent; the Zotero item overview in the middle uses grey and white rows, and I think it looks a little sloppy this way. The green is OK because it's obviously deliberately contrasting, but the neutral icon blends in with the white rows but contrasts with the grey rows.

brandonStell commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.5.25 ("transparent icon for muted")

Install in Zotero by downloading test build 0.0.5.25, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 4 years ago

I'm really sorry - I noticed one final, minor niggle. When there is no icon, the number changes position. Maybe insert a black image (or space) or the same size where the icon would be, to keep the numbers aligned in their part of the column?

I've made it a fully transparent png -- black looked a little jarring.

retorquere commented 4 years ago

I need the SVG so that the PubPeer logo shows in the Addons pane. It was previously just the default puzzle piece, it's now the whitish SVG. Once I know what to do for the neutral icon and the SVG I can tag a new release and then a new public release will be posted.

retorquere commented 4 years ago

This hasn't been merged to master yet BTW, so this isn't yet a version that people will automatically be upgraded to.