Skip to content

Commit

Permalink
Merge pull request #2475 from arunmathaisk/mkp-fix
Browse files Browse the repository at this point in the history
feat(marketplace): Change marketplace app GitHub repository visibility
  • Loading branch information
arunmathaisk authored Feb 13, 2025
2 parents 5abd5aa + 17c6f9a commit 32fe213
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,17 @@

frappe.query_reports['Marketplace App Repository Visibility'] = {
filters: [],
onload: async function (report) {
report.page.add_inner_button(__('Send Email to Developers'), () => {
frappe.confirm('Are you sure you want to send out the e-mails?', () => {
frappe.xcall(
'press.press.report.marketplace_app_repository_visibility.marketplace_app_repository_visibility.send_emails',
{
columns: JSON.stringify(report.columns),
data: JSON.stringify(report.data),
},
);
});
});
},
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
import json

import frappe
import requests


def send_developer_email(email, app_name, branch, repository_url, version):
dev = frappe.get_doc("User", {"email": email})
developer_name = dev.full_name
email_args = {
"recipients": email,
"subject": "Frappe Cloud: Make your app's GitHub Repository Public",
"template": "marketplace_app_visibility",
"args": {
"developer_name": developer_name,
"app_name": app_name,
"branch": branch,
"version": version,
"repository_url": repository_url,
},
}
frappe.enqueue(method=frappe.sendmail, queue="short", timeout=300, **email_args)


@frappe.whitelist()
def send_emails(columns, data):
frappe.only_for("System Manager")
data = json.loads(data)
for row in data:
visibility = row.get("visibility")
if visibility != "Private":
continue
app_name = row.get("app_name")
branch = row.get("branch")
repository_url = row.get("repository_url")
email = row.get("team")
version = row.get("version")
send_developer_email(email, app_name, branch, repository_url, version)


def check_repository_visibility(repository_url, personal_access_token):
try:
repo_parts = repository_url.split("github.com/")[1].rstrip(".git").split("/")
Expand Down
39 changes: 39 additions & 0 deletions press/templates/emails/marketplace_app_visibility.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% extends "templates/emails/base.html" %}

{% block content %}
<div class="p-8 bg-white">
<div class="from-markdown">
<p>Hi {{ developer_name }},</p>

<p>I hope this email finds you well.</p>

<p>I'm writing to inform you about an important policy update regarding Frappe Cloud Marketplace Apps. To
ensure continued availability on the Marketplace, all apps are now required to be fully open-source, meaning
the GitHub repository must be made public.</p>

<p>To comply with this new policy, please make your app's repository public within the next 2 weeks. After this
period, non-compliant apps will be disabled or removed from the Frappe Cloud Marketplace.</p>

<p>Here are the details for your app:</p>

<ul>
<li><strong>App Name:</strong> {{ app_name }}</li>
<li><strong>Repository URL:</strong> {{ repository_url }}</li>
<li><strong>Branch:</strong> {{ branch }}</li>
<li><strong>Version:</strong> {{ version }}</li>
</ul>

<p>We understand that this change might require some adjustments, and we appreciate your prompt attention to
this
matter. If you have any questions or anticipate any challenges in making your repository public, please
don't
hesitate to reach out to [email protected]. We're here to help and ensure a smooth transition.</p>

<p>Thank you for your understanding and cooperation.</p>

<p>Regards,<br>
Arun Mathai<br>
Engineer @Frappe Cloud</p>
</div>
</div>
{% endblock %}

0 comments on commit 32fe213

Please sign in to comment.