* feat: Added Subscription Banner for remotely logging into FrappeCloud dashboard from site (#18263) * feat: added Subscription Banner and Manage Subscription button * feat[patch]: added a patch for adding `Manage Subscription` button in navbar_settings * chore: removed console ;) * refactor: make the `Manage Subscription` navbar item optional * keep it hidden by default, only show when the site configs are present * style: prettier, isort and stuff * chore: handling null responses, translation and refactored patch * fix: correct index reset * perf: reduce network/db calls If not sys manager then why make a request? * fix: removed network call and added subscription_expiry to boot process * chore: added enable_manage_susbcriptions as daily background job and refactored patch * chore: added hook to hooks.py * this looks clean enough, also don't have insert for child tables ;) Co-authored-by: Ankush Menat <ankush@frappe.io> (cherry picked from commit 68f315d372cc8c6e41f2aabda61eba0d42dcf6e4) # Conflicts: # frappe/patches.txt * chore: conflicts * style: format [skip ci] Co-authored-by: Rutwik Hiwalkar <50401596+rutwikhdev@users.noreply.github.com>
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
import sys
|
|
from urllib.parse import urlparse
|
|
|
|
import requests
|
|
|
|
docs_repos = [
|
|
"frappe_docs",
|
|
"erpnext_documentation",
|
|
"erpnext_com",
|
|
"frappe_io",
|
|
]
|
|
|
|
|
|
def uri_validator(x):
|
|
result = urlparse(x)
|
|
return all([result.scheme, result.netloc, result.path])
|
|
|
|
def docs_link_exists(body):
|
|
for line in body.splitlines():
|
|
for word in line.split():
|
|
if word.startswith('http') and uri_validator(word):
|
|
parsed_url = urlparse(word)
|
|
if parsed_url.netloc == "github.com":
|
|
parts = parsed_url.path.split('/')
|
|
if len(parts) == 5 and parts[1] == "frappe" and parts[2] in docs_repos:
|
|
return True
|
|
if parsed_url.netloc in ["docs.erpnext.com", "frappeframework.com"]:
|
|
return True
|
|
|
|
|
|
if __name__ == "__main__":
|
|
pr = sys.argv[1]
|
|
response = requests.get(f"https://api.github.com/repos/frappe/frappe/pulls/{pr}")
|
|
|
|
if response.ok:
|
|
payload = response.json()
|
|
title = (payload.get("title") or "").lower()
|
|
head_sha = (payload.get("head") or {}).get("sha")
|
|
body = (payload.get("body") or "").lower()
|
|
|
|
if title.startswith("feat") and head_sha and "no-docs" not in body:
|
|
if docs_link_exists(body):
|
|
print("Documentation Link Found. You're Awesome! 🎉")
|
|
|
|
else:
|
|
print("Documentation Link Not Found! ⚠️")
|
|
sys.exit(1)
|
|
|
|
else:
|
|
print("Skipping documentation checks... 🏃")
|