The-Commit-Company / raven

Simple, open source team messaging platform
https://thecommit.company/products/raven
GNU Affero General Public License v3.0
296 stars 120 forks source link

Channels per user role type and per department of the company #928

Closed SamuelLHuber closed 1 month ago

SamuelLHuber commented 4 months ago

Hello, thank you for building Raven!

Would love to create private channels that are automatically assigned to users based on their roles in Frappe/ERPNext.

We have many different departments and would love to make the user role e.g. Sales have their own private channel that other people can't see unless they have been manually added or have the role.

same goes for our internal departments. Webdesign shouldn't see the video production departments channel.

Manually adding/removing users if they leave the company or change roles is cumbersome.

Same goes for projects, would love to create a project in ERPNext and then create a channel for it with the assigned people to the project so the team + customer can communicate together in Raven.

Cheers, Samuel

nikkothari22 commented 4 months ago

Hey @SamuelLHuber,

As of now, these can be done via Raven Bots and some Python scripts in a custom app, but we can build a native ERPNext integration in Raven itself.

As far as I understand, you want to:

  1. Create a private channel when a new project is created. When a user is added to the project, add them to said channel. We will have to understand how the Project module works in ERPNext.
  2. Create a private channel for each department, and add the employees in that department to the channel. If the department changes, then remove the employee from the channel. This would be an integration with ERPNext and FrappeHR.

I don't think this can be done directly via "Roles" since the role itself is dependent on how the admins have configured it. What we can do is use standard DocTypes/fields in ERPNext/HR like Department, Employee, Project and use that to create Raven Channels.

Is my understanding correct?

SamuelLHuber commented 4 months ago

Cheers @nikkothari22 thanks for the fast reply, is there documentation available on the bots? have some ideas where I'd like to run them too, outside of the above.

Regarding

1) yes, but not high priority

Project has users in the Project DocType which would work well to pull the users which should have access

2) yes! exactly. If not available via roles the department doctype would suffice

though users are also available programmatically Employee Doctype

Department is available in Code here

nikkothari22 commented 4 months ago

Awesome!

We'll add native integrations for both those scenarios next week, but would like some assistance in testing it maybe since we don't use projects/departments ourselves.

Regarding Raven Bots: we haven't added docs yet, but it works something like this:

my_bot = frappe.get_doc("Raven Bot", "my-bot")

my_bot.send_message(...)

The methods are available here:

https://github.com/The-Commit-Company/Raven/blob/develop/raven/raven_bot/doctype/raven_bot/raven_bot.py

Create the bot first (it's a Doctype), and if using a custom app, just export it as a fixture.

SamuelLHuber commented 4 months ago

For sure will be available to test. Thank you! Great to hear that.

For the progressive web app at raven_mobile we didn't get a settings toggle for push notifications and not recieving them. How do we set these up? the profile page doesn't have anything would have expected an "enable notifications" toggle there.

PS: Saw on the webpage push notifications coming later this year, if there's something we can do to aid make that available earlier please let us know.

nikkothari22 commented 4 months ago

For the progressive web app at raven_mobile we didn't get a settings toggle for push notifications and not recieving them. How do we set these up? the profile page doesn't have anything would have expected an "enable notifications" toggle there.

On Raven Mobile, the push notification toggle will appear on the settings page only when:

  1. The PWA is "installed" on the device
  2. Push notifications are enabled via "Push Notification Settings". This is a Frappe framework feature. If you're on Frappe Cloud, your site will connect to a relay server for push messages automatically. If you're self hosting, you'll have to host the relay server - that's another Frappe app which is not yet open sourced and is managed by Frappe.

PS: we're going to deprecate the separate mobile PWA and make the web app work on mobile devices as a responsive web app. There's an open PR for that.

SamuelLHuber commented 3 months ago

nice, enabled, so testing Push Notifications now, see it in settings. Thank you

nikkothari22 commented 3 months ago

Hey @SamuelLHuber ,

Sorry this took a little longer to build. Can you see if the conditions specified in #966 suit your use case?

SamuelLHuber commented 2 months ago
Screenshot 2024-07-12 at 12 53 11

can't see where to add / link when creating a channel

nikkothari22 commented 2 months ago

The department channels will get auto created when a department is created. You need to enable this in Raven Settings.

SamuelLHuber commented 2 months ago
Screenshot 2024-07-12 at 13 55 54

I don't see a toggle in the raven settings using /app/raven-settings/Raven Settings

though in /app/department I see 13 departments and the all departments group

we are on the following raven version: https://github.com/The-Commit-Company/Raven/commit/de5feb2d5820fe91a451341217b333de1be905db

with no updates shown Screenshot 2024-07-12 at 14 00 36

nikkothari22 commented 2 months ago

Are you on the main branch or develop branch?

SamuelLHuber commented 2 months ago

main

nikkothari22 commented 2 months ago

Oh okay. Yeah, we were testing this feature on develop. Will release it.

nikkothari22 commented 2 months ago

@SamuelLHuber this is now available in the latest release of Raven.

SamuelLHuber commented 2 months ago

@SamuelLHuber this is now available in the latest release of Raven.

thank you! new release feels really snappy on Web.

open, everyone is a member. is lovely

departments channels after I activate it isn't created for existing departments but works well for creating and deleting departments

blaggacao commented 2 months ago

@nikkothari22 image

As it is presented, it appears that this only works when installed with HRMS app, but as far as I understand, it doesn't depend on Frappe HRMS.

I don't know if it's a good idea, but maybe the integration section could list as "Frappe Ecosystem" to group the various Frappe upstream apps here (as long as there's an integration) and then move the marked section under a "ERPNext" header.

nikkothari22 commented 1 month ago

@blaggacao Yes, that's the plan eventually. We'll add more app integrations and then organize them into better sections. We might need separate "sections" for HR and Payroll as well. Haven't thought about it as of now, but the layout would definitely change.

nikkothari22 commented 1 month ago

Completed via #966