Skip to content

Commit

Permalink
chore: make a default workspace on install
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkothari22 committed Dec 6, 2024
1 parent 531bfca commit cec204e
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion raven/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,35 @@ def create_raven_user_for_administrator():


def create_general_channel():
default_workspace = frappe.get_doc(
{
"doctype": "Raven Workspace",
"workspace_name": "Raven",
"type": "Public",
}
)
default_workspace.insert(ignore_permissions=True)

# Make all users a member of this workspace and set them as admins
users = frappe.get_all("Raven User")
for user in users:
frappe.get_doc(
{
"doctype": "Raven Workspace Member",
"workspace": default_workspace.name,
"user": user.name,
"is_admin": True,
}
).insert(ignore_permissions=True)

channel = [
{"doctype": "Raven Channel", "name": "general", "type": "Open", "channel_name": "General"}
{
"doctype": "Raven Channel",
"name": "general",
"type": "Open",
"channel_name": "General",
"workspace": default_workspace.name,
}
]

make_records(channel)

0 comments on commit cec204e

Please sign in to comment.