debtcollective / parent

1 stars 0 forks source link

Display all messages in the Discourse PM related to a Dispute in the "Dispute edit status" view in the tools backoffice #205

Closed orlando closed 5 years ago

orlando commented 6 years ago

Since we are moving the Dispute user communication to Discourse, we need a way to quickly see the messages in Discourse from the back office.

We currently have this view with a list of messages

image

The idea is to list both the comments in the Discourse PM and the admin notes in chronological order.

Also, while working on this, is a good time to display the actual admin name when creating notes instead of The Debt Collective

image

Tasks

Acceptance criteria

sarayourfriend commented 6 years ago

Are we sure we need this for launch? This will not be doable before October 1st at our current velocity.

orlando commented 6 years ago

Yeah this is not a blocker for the Release, and this can work by asking the admins to go to the Discourse message for now. I'll move it to low priority for now

sarayourfriend commented 6 years ago

I've been tossing around ideas for this in my head and have come up with three possibilities for us to consider, I think they each have trade offs that are relatively clear, but I'm having a hard time deciding which route we should take and would like some input.

  1. Retrieve the thread from the front-end, relying on the logged in admin's discourse cookie to be able to make the ajax requests for the given thread
  2. Retrieve the thread from the tools back-end, relying on the system user we use to make api requests for SSO
  3. Embed a link to the thread in an iframe & force the iframe into a mobile view to get a cleaner experience

Off the cuff, the first two require us to basically recreate the thread view Discourse already has but in the tools. We'd do this using Vue and could make it it's own little Vue app and be very clean. If we wanted admins to be able to respond, we'd have to embed a visual editor, etc. Basically like I said, recreating the thread view Discourse already has, but in our own stuff. The second option (retrieving the messages from the backend) also runs into the rate limiting issues we had before. The first option wouldn't have that problem (operating like the embedded header).

The third is probably the most interesting to me. It requires the least amount of work and we would get a lot of things for free. The problems there are that we would probably want to disable Discourse's header from showing within the iframe, but we can do that with the theme plugin, query parameters (or iframe options) and some css trickery. There are probably other things we'd want to disable, but it would along those lines.

What do you think @orlando?

orlando commented 6 years ago

@marcondag yeah 3 sounds good, but we will need to have control on how we render the messages. We need to display all messages (including admin notes from the tools) chronologically, so the approach we should take is 2. Something like:

  1. Pull all the messages from the Dispute PM. I'm not expecting this to become a performance issue due to the number of messages we may have.
  2. Combine these messages with the admin notes for the Dispute. This can be done in the backend and just return JSON/HTML.
  3. Display the messages in the edit status modal.

To reply to a message, admins need to go to Discourse. Implementing this with all the features in the tools will be hard (attachments, markdown, mentions etc etc etc). We may take admins to a specific message in Discourse if they click on top of it in the tools, but no more than that.

About the style, we can use the same style we have, maybe increasing the width of the modal for more readability.

sarayourfriend commented 6 years ago

Okay, that sounds good. I think we actually wouldn't be able to do 1 or 3 anyway because only admins assigned to the dispute (either via a group they are in or directly) would be able to see the PM. If we pull the messages from the back-end that will not be a problem.

But that brings up another question, currently if you're just a dispute_pro and you go to a dispute in the backoffice that you're not assigned to a click the "Open Discourse Thread" button, you'll be denied access to the PM, right? I can't test it right now but it just dawned on me, if you could check that. We should let the organizers know. The workaround is just that you'd have to assign yourself to the dispute causing you to get added to the thread in Discourse.

Option 2 at least makes it possible for any admin to read the thread for a dispute, but the problem of being able to reply will still exist.

Given that it doesn't need to be interactive or reactive, returning the rendered HTML from that endpoint with an ajax request makes sense, might be the fastest approach instead of using Vue & the cost it will inevitably incur.

orlando commented 6 years ago

@marcondag cool I'll check. If non assigned admins can't see the PM in Discourse then I think it's fine, is a way to enforce that only people related to the dispute is able to message the user.

orlando commented 5 years ago

Closing this as we are leaving the current dispute-tools repo in maintenance mode