Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement open inbox for dev-connect #1563

Merged
merged 52 commits into from Mar 15, 2019

Conversation

mariocsee
Copy link
Contributor

@mariocsee mariocsee commented Jan 15, 2019

What type of PR is this? (check all applicable)

  • Feature

Description

This PR adds open inbox to users that want to allow others to message without mutually following each other.

The column inbox_type is added to Users with "private" as the default value. The only other option right now is "open." This can be changed under settings/misc.

An inbox_type of "private" retains the previous (default) behavior of DEV Connect, where only users that mutually follow each other can send messages to one another. Now, if you view a user you follow and that follows you, a chat button will be displayed beside the following button.

An inbox_type of "open" displays a chat button on your profile and allows any user, whether you mutually follow each other or not, to open a chat with you on DEV Connect. This works by calling the open_chat method in users_controller and creating a chat channel (if none already exist between you and the user with an open inbox) and redirect you to dev.to/connect/@username.

To-do:

  • Add initial message (when a new channel is opened, the default message on top is "You and @mozellmrsprohaska are connected because...", but with an "open" inbox_type that message is false and needs to be changed for clarity)
  • Chats that are made inactive because of unfollows can be made active again if inbox_type is open
  • Rspec tests for follows_controller pass given changes in show

Related Tickets & Documents

resolves #1460

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Changing your inbox type in settings/misc

settings-change-inboxtype

Follow Back button for users that follow you

dev-follow-back

Users that you follow and follow you have a chat button that redirects to the chat channel between you

mutual-follow-chat

Manually changing inbox type to "open" for testing in local environment

change-inbox-type

New chat for users with open inbox type

open-inbox-new-msg

If you mutually follow someone who has an open inbox, it will prioritize redirecting straight to connect/@username

Added to documentation?

  • no documentation needed

mariocsee and others added 2 commits January 15, 2019 16:02
- generated a migration
- added open_inbox as a permitted attribute
- added checkbox in settings/profile to indicate whether user is open to messages from anyone
- added indicator "i'm open to chatting" on profile to test attribute
@benhalpern
Copy link
Contributor

Looks good so far. A future thoughts/headsup:

  • The "Message Me" button on the profile should exist for open inboxers and folks who have message permission based on mutual follows. Since pages can be edge cached and we can't calculate that on the fly, we will need to do this with JS similar to how we do the follow button. (But I think perhaps we can merge other functionality and figure out the UI stuff later.
  • Perhaps instead of boolean inbox we have a string inbox_type because there could be different types other than closed and opened in the future.
  • I'm definitely interested to see how you manage the creation of Chat channels on the fly here. We'll need to make sure it's all logically compatible with mutual-follow inboxes.
  • Looks like there are some schema issues with some extra files included here. Not a big deal, but sometimes you need to drop old DB stuff and check for this. I make this mistake too sometimes.

Good luck, this will be awesome!

- changed column name, type and default value
- setttings/profile inbox menu has options select now -- can add more inbox types in the future
- link to open_chat is displayed if either the user's inbox type is open or if the user and current user follow each other
- open_chat checks if a chat channel exists between the two users and makes a channel if not and redirects to connect with the users slug
@mariocsee
Copy link
Contributor Author

mariocsee commented Feb 4, 2019

@benhalpern I just updated the PR description and screenshots. There's some to-dos I added as well. The button is implemented in initializeAllChatButtons.js which closely follows initializeAllFollowButtons.js (but removes a lot of lines that aren't used for chat). Also CC has a lot of issues with the new file that occur in almost all initialize JS files, so I committed with no-verify to check everything is working properly first.

@mariocsee
Copy link
Contributor Author

mariocsee commented Feb 5, 2019

Refactored how mutual checks are done by extending show in follows_controller.rb and making use of FollowChecker in the opposite direction rather than passing the list of IDs a user follows and searching through that list (since the list can become very large depending on the user).

If you unfollow a mutually followed user, the chat between you two is rendered inactive. If that user has an open inbox_type, clicking chat will not create a new channel but instead render that existing (but hidden) chat active.

@mariocsee mariocsee changed the title [WIP] Implement open inbox for dev-connect Implement open inbox for dev-connect Mar 7, 2019
@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Mar 7, 2019
Copy link
Member

@maestromac maestromac left a comment

Choose a reason for hiding this comment

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

👍

@maestromac maestromac merged commit d8709c0 into forem:master Mar 15, 2019
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: unreviewed bot applied label for PR's with no review labels Mar 15, 2019
@mariocsee mariocsee mentioned this pull request Mar 15, 2019
2 tasks
@mariocsee mariocsee deleted the connect-open-message branch March 18, 2019 20:11
@mariocsee mariocsee mentioned this pull request Apr 16, 2019
2 tasks
@mariocsee mariocsee mentioned this pull request May 16, 2019
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Open connect/inbox
3 participants