Skip to content

Commit

Permalink
web : setup > show warning if connection no longer accessible through…
Browse files Browse the repository at this point in the history
… github app
  • Loading branch information
dsevillamartin committed Jan 9, 2024
1 parent 3f65000 commit d14219a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/Web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ app.post(
category: 'webhook.receive.app',
message: `[${delivery}] ${event}${actionText} from ${repo || eventOwner}`,
data: {
delivery,
repo,
channels: channels.map((c) => c.get('id')),
},
Expand Down
2 changes: 1 addition & 1 deletion lib/Web/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ module.exports = (app) => {
]);

// Reset ratelimiter if the user is on a valid dashboard
req.resetKey(req.ip);
limiter.resetKey(req.ip);

res.render('setup', {
connections,
Expand Down
18 changes: 16 additions & 2 deletions views/setup.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,18 @@
<h4 class="is-size-4">
GitHub App
</h4>
<% let anyMissing = false %>
<ul>
<% connections.forEach(function (conn) { %>
<li class="is-clearfix">
<div class="is-pulled-left mr-2">
<%- include('./partials/setup-button', { type: conn.get('type'), id: conn.get('githubId'), connected: true }) %>
</div>
<% const result = conn.get('type') == 'install'
<% const result = conn.get('type') === 'install'
? githubApp.map(v => v[0]).find(v => v?.id == conn.get('githubId'))
: githubApp.map(v => v[1]?.find(v => v.id == conn.get('githubId'))).filter(Boolean)[0] %>
<% const ghName = (conn.get('type') == 'install'
<% const ghName = (conn.get('type') === 'install'
? result?.account?.login
: result?.full_name || result?.name
) || conn.get('githubName') %>
Expand All @@ -180,9 +181,22 @@
</a>
(<%= conn.get('type') %>)
<% if (!result) { %>
<% anyMissing = true %>
<span class="tag is-danger is-light">
<i class="fas fa-exclamation-triangle"></i>
</span>
<% } %>
</li>
<% }) %>
</ul>
<% if (anyMissing) { %>
<div class="notification is-warning p-3">
Some of the connections above are no longer valid. The GitHub app may have lost access to them.
You will not receive events from them.
</div>
<% } %>
</section>
</div>
</div>
Expand Down

0 comments on commit d14219a

Please sign in to comment.