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

feat: better installation message #864

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions raven/install.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
import click
import frappe
from frappe.desk.page.setup_wizard.setup_wizard import make_records


def after_install():
add_standard_navbar_items()
create_general_channel()
try:
print("Setting up Raven...")
add_standard_navbar_items()
create_general_channel()

click.secho("Thank you for installing Raven!", fg="green")

except Exception as e:
BUG_REPORT_URL = "https://github.com/The-Commit-Company/Raven/issues/new"
click.secho(
"Installation for Raven failed due to an error."
" Please try re-installing the app or"
f" report the issue on {BUG_REPORT_URL} if not resolved.",
fg="bright_red",
)
raise e


def create_general_channel():
if not frappe.db.exists("Raven Channel", "general"):
channel = frappe.new_doc("Raven Channel")
channel.channel_name = "General"
channel.name = "general"
channel.type = "Open"
channel.save(ignore_permissions=True)
# Part of installation, hence needs to be committed manually
frappe.db.commit() # nosemgrep
channel = [
{"doctype": "Raven Channel", "name": "general", "type": "Open", "channel_name": "General"}
]

make_records(channel)


def add_standard_navbar_items():
Expand Down
Loading