karrot-dev / karrot-frontend

We migrated to https://codeberg.org/karrot/karrot-frontend
https://codeberg.org/karrot/karrot-frontend
428 stars 177 forks source link

Proposal to add reusable conversation feature #539

Closed nicksellen closed 7 years ago

nicksellen commented 7 years ago

https://github.com/yunity/foodsaving-frontend/issues/520 discusses general chat/community features, this ticket is a specific proposal to implement a "conversation" feature.

The rationale is that community organising features are currently missing which limits adoption of the software, and this is close to the simplest implementation that might support sufficient community organising.

The proposal is to implement a django app (module) inside the foodsaving tool that implements a simple model (conversation with participants and messages) that can be used to represent communication between 2 or more users.

Initially it would just be implemented so that each group has a "wall"-like interface where users can post simple text messages. Updates would be pushed over the websocket connection, to enable it to work like a realtime chat system.

The conversation/chat module would be implemented as independently as possible from the existing models so it could be added in other places when we are ready (e.g. private 1-to-1 messages between users, topic-based forum-style discussions, private team conversations, etc).

Another possibility for the future would be to allow the messages to be more sophisticated than plain text, and include rich information (e.g. formatting, emoticons, requesting help for a pickup, asking a question, .. etc.), but this would not be considered initially.

For the implementation, Django Channels implements async features for Django which enables handling of websockets connections within Django (previously we had nodejs apps on the side). This keeps the complexity down for development and deployment as nothing else needs to be added, it probably increases the minimum version of python that we support though.

I would be up for implementing this in the backend, and a corresponding angular service that consumes the new API endpoints, and perhaps a basic PoC UI view. Alternatively, if we agree on these features we could allocate this task to other people who are looking for tasks as it is reasonably self contained.

A few outstanding questions:

nicksellen commented 7 years ago

I put my python websocket playing here --> https://github.com/nicksellen/python-websockets-play

tiltec commented 7 years ago

are the features described sufficiently useful to increase adoption/utility of the tool?

From my experience with foodsharing.de, the mostly used feature is the chat. Surely, there are many chat platforms around and they will continue getting used, but people tend to use the platforms where they also can communicate.

is the extensibility described in the right direction for what we envision?

I like the simplicity of this model and that we could potentially use it as wall-style conversation, as well as 1-on-1 chat. The integration with Django channels makes data exchange a lot easier compared to interfacing with standalone software.

is the implementation favourable compared to the options discussed in #520 ?

Well, I would have liked the federation of matrix, the polished interface of discourse or the decision-making features of loomio, but they are different platforms in the end. Even if a tight integration is possible (which I'm not sure about), it might still not feel like a fs.world chat and therefore drive the users away from the page. So, I would say in terms of usability, this implementation should be better.

does adding django channels impact the existing django project negatively?

Needs an experiment, however I don't think so. Channels being an official Django project, we should get regular security updates and a sane deprecation policy. Would you be up for a demo that runs within fstool, basically the PoC?

does it have an impact for running in production?

Might complicate deployment a bit.

I would be up for implementing this in the backend, and a corresponding angular service that consumes the new API endpoints, and perhaps a basic PoC UI view.

Yeah!!!

nicksellen commented 7 years ago

Would you be up for a demo that runs within fstool, basically the PoC?

Yes, good idea.

I still didn't quite fully understand how the channels works with sync vs async code, usually they don't mix very well. However I think they are very nice clever people and they address it directly:

Channels is different - all the code you write for consumers runs synchronously. You can do all the blocking filesystem calls and CPU-bound tasks you like and all you’ll do is block the one worker you’re running on; the other worker processes will just keep on going and handling other messages.

This is partially because Django is all written in a synchronous manner, and rewriting it to all be asynchronous would be a near-impossible task, but also because we believe that normal developers should not have to write asynchronous-friendly code.

http://channels.readthedocs.io/en/stable/faqs.html

brnsolikyl commented 7 years ago

From our perspective, starting with a simple conversation wall for the group would work wonders! Simply because it will be easier for people to discuss matters pertaining to pickups and the cooperation with the store, and easier to find it among the mess that our simple forum has become.

If later this mechanism can be easily implemented in other places, like private chats and conversation walls on the store pages, then I think it's a good way to go!

Sliverriver commented 7 years ago

if it helps for you as a proposal i made a small mockup - although a chat would be nice, the problem with chat in generall isthat you can't group a conversation. of course anything is better then nothing :-D

converstion example

it's basically what we are used from facebook :-D

and later on there could be notification for dunno - following a topic, or new conversations in a group / store. or maybe if i write a conversation i want to mark it as important.

My thoughts are : What do i need ? I need a way to contact people that they also take notice of.

When i write : I need someone to replace me on monday - it's now done in the chat on fs.de , but some people also write on the wall - because they feel like they are bothering people in the chat.

nicksellen commented 7 years ago

I think the feature you're wanting in your mockup is conversation threads. It's not something I included in this proposal, to keep it simpler to implement - but there is no limitation for adding in the future if that seems useful, but I would wait until the simple version is implemented before discussing it further.

The purpose of implementing the simplest thing is to define something we can build now, but also that will not put too many limitations on what we want the conversations to be used for in the near future - I believe the proposal meets that goal.

nicksellen commented 7 years ago

I'm going to close this, as the proposal was accepted!

Backend pull request https://github.com/yunity/foodsaving-backend/pull/333 Frontend service issue https://github.com/yunity/foodsaving-frontend/issues/583

... there is no work yet on the actual UI for it.