Skip to content

Allow groups to have conversations with other groups or users#6009

Merged
microstudi merged 55 commits intodecidim:developfrom
Platoniq:feature/send-to-groups
May 21, 2020
Merged

Allow groups to have conversations with other groups or users#6009
microstudi merged 55 commits intodecidim:developfrom
Platoniq:feature/send-to-groups

Conversation

@microstudi
Copy link
Copy Markdown
Contributor

@microstudi microstudi commented Apr 21, 2020

🎩 What? Why?

Allow groups to have private conversations between them and/or normal users.
It uses the multi-user messaging capabilities introduced in #5681.

Groups can start new conversations from their profile page. Normal users still maintain the independent conversation page but they can have conversations with groups too.

Notes:

  1. when a group send a message, all their co-admins receive a message informing of the fact.
  2. when a user writes to a user, all its co-admins receive the message.
  3. co-admins will never receive an email if they have the "restrict direct messages" introduced in Feature/receive messages from everyone #5720 on, unless they specifically follow the group.
  4. conversations between members of the group ant its own group are allowed.

There are 6 types of templates for an email sent (class ConversationMailer) as a result of this:

  1. message to human recipients when starting a new conversation new_conversation
  2. message to admins of the group when a recipient is this group and someone started a new conversation new_group_conversation
  3. message to co-admins of a group when this group starts a new conversation comanagers_new_conversation
  4. message to human recipients when posting a new message in an existing conversation new_message
  5. message to admins of the group when a recipient is this group and someone posted a new message in an existing conversation new_group_message
  6. message to co-admins of a group when this group posts a new message in an existing conversation comanagers_new_message

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Add tests

📷 Screenshots (optional)

image

image

image

microstudi and others added 30 commits March 31, 2020 20:04
* Fix supported versions in SECURITY.md

* Add changelog entry
* Allow to create conversations with more than one participant

* Added new form param to converstation controller

* Check conversation with multiple users

* Clean code debugs

* Added changelog file

* Cleans debug code line

* Fixes rubocop offenses

* Fixes some js lints

* Disable mentioning users with notifications disabled

* Fixes a) some js linter issues b) refactor some helper methods c) added more conversation_controller_spec tests

* Adds multiple participants's conversations rspec tests

* Add validations for avoiding selecting users with disabled notifications for conversations

* Add test for mention with disabled users

* Fixes a) unused translations tags b) Fixed conversations index test

* Fixes js linter issues

* Fixes a) conversation form validator b) conversations controller test

* Normalizes en.yml locales file

* Fixes linter conversation index erb template

* Add start_conversation_dialog.js to precompiler

* Fixes conversation js tag dependency

* Applies some PR's CR suggestions: a) Move deleteRecipient method  inside anonymous function b)

* Modification of name class for disabled tribute element and modification of jquery selector by javascript selector on tribute.js library

* Fix users on selectable mention list shown disabled by acceptance of conversation value

* Fixes multiple mention dropdown style. Adds no results translation

* Normalizes locale en.yml file

* Remove scope selecting only follower user due to a subsequent validation

* Adds avatar to user's dropdown multi-mention, to be like mention

* Fixes a) js includes b) enlights multiple mention input placeholder

* Rename disabledNotifications by directMessagesEnabled field on api

* Rewrite context message on conversations_spec.rb on mentioned list

* Add initial comment to inform that the original file is modified to include a modification on click event

* Fix lint errors

* Remove defined field directMessagesEnabled from author_interface and user_group_type and change api call from input_multiple_mentions.js.es6

* Fixes some styling changes to add users to conversation modal dialog

* Fixes a) unnecessary setTime function call b) change on input placeholder c) adds extra label with max users information d) some translations

* Modify user presenter to return boolean on directMessagesEnabled

* Add spec for directMessagesEnabled

* Fix lint rubocop issues

* Adds a debounce delay call to avoid api calls when keys are pressed so fast

* Fixed translations en.yml lint

* Adds some accessibility functionality on New Conversation modal

* Fixes some lints

* Update CHANGELOG.md

Co-Authored-By: Ivan Vergés <ivan@platoniq.net>

* Adds some more aria pattern to relate label and input elements

* Update decidim-core/app/presenters/decidim/user_presenter.rb

Co-Authored-By: Ivan Vergés <ivan@platoniq.net>

* Fixes bad code review merge for api user presenter

* Fixes linter issue

Co-authored-by: Ivan Molinero <ivan.mr@coditramuntana.com>
Co-authored-by: Jesús Di Bari <jesus.db@coditramuntana.com>
Co-authored-by: Ivan Vergés <ivan@platoniq.net>
* Add two cta on initiative

* Normalize locales

* Normalize locales

* Add changelog entry

* Update cta redirection (#9)

* erb files linting

* change cta redirection to initiatives_path

* Use EngineRouter main_proxy for redirection

* Add two missing tests (#5)

Co-authored-by: Armand Fardeau <armandfardeau@users.noreply.github.com>

Co-authored-by: Quentin Champ <26109239+Quentinchampenois@users.noreply.github.com>
Co-authored-by: Oliver Valls <oliver.vh@coditramuntana.com>
* Don't follow the header x forwarded host by default

* Use accessor directly

* Add changelog entry

Co-authored-by: Oliver Valls <oliver.vh@coditramuntana.com>
* migration to remove legacy fields

* fix changelog

* rename migration

Co-authored-by: Oliver Valls <oliver.vh@coditramuntana.com>
# Conflicts:
#	decidim-core/app/assets/javascripts/decidim/input_multiple_mentions.js.es6
#	decidim-core/app/commands/decidim/messaging/start_conversation.rb
#	decidim-core/app/controllers/decidim/messaging/conversations_controller.rb
#	decidim-core/app/forms/decidim/messaging/conversation_form.rb
#	decidim-core/app/helpers/decidim/messaging/conversation_helper.rb
#	decidim-core/spec/system/messaging/conversations_spec.rb
@tramuntanal
Copy link
Copy Markdown
Contributor

hi @microstudi , tests in develop branch are succeeding it seems that the problem is in this branch. Can you check the tests locally please?

@microstudi
Copy link
Copy Markdown
Contributor Author

@tramuntanal , this is finished!

Copy link
Copy Markdown
Contributor

@Leusev Leusev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! Great job @microstudi
I only left a couple of minor things 🔍
There's changelog file conflict too

<% user_grouped_messages.each do |sender, messages| %>
<%= render "messages", sender: sender, messages: messages %>
<% end %>
<% conversation.messages.each do |message| %>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this conversation.messages.each block left over? it seems it makes an unnecessary loop with an empty code block

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed! good catch!

@microstudi
Copy link
Copy Markdown
Contributor Author

@Leusev it should be ok now!

Copy link
Copy Markdown
Contributor

@Leusev Leusev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for me @microstudi
Only if you could take a look at that changelog entry
Thanks!!

@Leusev Leusev self-requested a review May 21, 2020 14:52
Copy link
Copy Markdown
Contributor

@Leusev Leusev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swear I saw it 🙄 😅
All ok now!! 😄

@microstudi
Copy link
Copy Markdown
Contributor Author

@decidim/product is this ok from your side? have you tested it?

@carolromero
Copy link
Copy Markdown
Member

yep, checked! 👍 well done @microstudi

@microstudi microstudi merged commit 62db551 into decidim:develop May 21, 2020
@mrcasals
Copy link
Copy Markdown
Contributor

This PR causes some test failures:

https://github.com/decidim/decidim/runs/704413614

Can you check this? @microstudi

@mrcasals mrcasals mentioned this pull request May 25, 2020
8 tasks
@microstudi
Copy link
Copy Markdown
Contributor Author

Thanks @mrcasals looking at it. strange as tests where fine before merging.

@microstudi
Copy link
Copy Markdown
Contributor Author

This seems to be a flaky test... after restart the job succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

project: AM2019 Barcelona City Council contract

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Send private messages to groups

6 participants