]> git.lizzy.rs Git - cheatdb.git/commitdiff
Add links to GitHub oauth connection settings v1.23.5
authorrubenwardy <rw@rubenwardy.com>
Thu, 30 Jan 2020 21:39:51 +0000 (21:39 +0000)
committerrubenwardy <rw@rubenwardy.com>
Thu, 30 Jan 2020 21:39:51 +0000 (21:39 +0000)
app/blueprints/github/__init__.py
app/flatpages/help/release_webhooks.md
app/templates/github/setup_webhook.html
app/templates/users/profile.html

index 1d160a2ac2c4a43916ae0ea9763ccd677e062379..7477238e94418d1f47b6bdf126bc0d26bae091af 100644 (file)
@@ -18,7 +18,7 @@ from flask import Blueprint
 
 bp = Blueprint("github", __name__)
 
-from flask import redirect, url_for, request, flash, abort, render_template, jsonify
+from flask import redirect, url_for, request, flash, abort, render_template, jsonify, current_app
 from flask_user import current_user, login_required
 from sqlalchemy import func
 from flask_github import GitHub
@@ -35,6 +35,12 @@ from wtforms import SelectField, SubmitField
 def start():
        return github.authorize("", redirect_uri=abs_url_for("github.callback"))
 
+@bp.route("/github/view/")
+def view_permissions():
+       url = "https://github.com/settings/connections/applications/" + \
+                       current_app.config["GITHUB_CLIENT_ID"]
+       return redirect(url)
+
 @bp.route("/github/callback/")
 @github.authorized_handler
 def callback(oauth_token):
index e9a9f8185bbfe9ddbf8f1cc6f2e2ad1ff791c82d..2d751a5a3f0a47be7ae818fc1bed1a37166b24f2 100644 (file)
@@ -23,19 +23,20 @@ The process is as follows:
 
 ## Setting up
 
-### Github (automatic)
+### GitHub (automatic)
 
-1. Go to your package page.
+1. Go to your package's page.
 2. Make sure that the repository URL is set to a Github repository.
    Only github.com is supported.
-3. Go to "Create a release", and click "Setup webhook" at the top of the page.
+3. Go to "Releases" > "+", and click "Setup webhook" at the top of the create release
+   page.
    If you do not see this, either the repository isn't using Github or you do
    not have permission to use webhook releases (ie: you're not a Trusted Member).
 4. Grant ContentDB the ability to manage Webhooks.
-5. Set the event to either "New tag" or "Push". New tag is highlight recommended.
+5. Set the event to either "New tag or Github Release" (highly recommended) or "Push".
 
    N.B.: GitHub uses tags to power GitHub Releases, meaning that creating a webhook
-   on "new tag" will sync GitHub and ContentDB releases.
+   on "New tag" will sync GitHub and ContentDB releases.
 
 ### GitHub (manual)
 
@@ -48,7 +49,7 @@ The process is as follows:
 7. Set the events
   * If you want a rolling release, choose "just the push event".
   * Or if you want a stable release cycle based on tags,
-   choose "Let me select" > Branch or tag creation.
+    choose "Let me select" > Branch or tag creation.
 
 ### GitLab (manual)
 
index d0012e2219623a347fc86f4ce88603dadde3cf4e..d1a2bc6341796cf00323d7c88d250d72498034ce 100644 (file)
 
                {{ render_submit_field(form.submit) }}
        </form>
+
+       <p class="mt-4">
+               You will need admin access to the repository.
+               When setting up hooks on an organisation,
+               <a href="{{ url_for('github.view_permissions') }}">make sure that you have granted access</a>.
+       </p>
 {% endblock %}
index d2f5baa254ba720c34e44ece98df0d8cc5ce994f..37ee5df0b99b1b39b1870502c62a70f01eea1c81 100644 (file)
@@ -64,6 +64,7 @@
                                                                        | <a href="{{ user.website_url }}" rel="nofollow">Website</a>
                                                                {% endif %}
 
+
                                                                {% if user == current_user %}
                                                                        <br>
                                                                        <small class="text-muted">
                                                                {% endif %}
                                                        </td>
                                                </tr>
+
+                                               {% if user == current_user and user.github_username %}
+                                                       <tr>
+                                                               <td>Privacy:</td>
+                                                               <td>
+                                                                       <a href="{{ url_for('github.view_permissions') }}">View ContentDB's GitHub Permissions</a>
+                                                               </td>
+                                                       </tr>
+                                               {% endif %}
+
                                                {% if current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.MODERATOR) %}
                                                <tr>
                                                        <td>Admin</td>
                                                                                </a>
                                                                        {% endif %}
                                                                </td>
-                                                       </tr>
+                                               </tr>
                                                        <tr>
                                                                <td>Password:</td>
                                                                <td>