Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Commit 2fa9cda

Browse files
authored
Merge pull request #99 from djcruz93/fine-grained-access
[FIX] Migrate Github oauth to Github apps
2 parents 9ca59cb + 2f666f7 commit 2fa9cda

22 files changed

Lines changed: 206 additions & 358 deletions

File tree

client/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
work correctly both with client-side routing and a non-root public URL.
2121
Learn how to configure a non-root public URL by running `npm run build`.
2222
-->
23-
<title>RC4Community</title>
23+
<title>RCforCommunity</title>
2424
</head>
2525
<body>
2626
<noscript>You need to enable JavaScript to run this app.</noscript>

client/src/components/ActivityPane/index.js

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import ActivityItem from "./../ActivityItem";
55
import MuiAlert from "@material-ui/lab/Alert";
66
import { Snackbar } from "@material-ui/core";
77
import ConfigureWebhook from "../ConfigureWebhook";
8-
import {
9-
githubPrivateRepoAccessClientID,
10-
githubApiDomain,
11-
} from "../../utils/constants";
8+
import { githubApiDomain } from "../../utils/constants";
129
import { IoSettingsOutline } from "react-icons/io5";
1310

1411
import "./index.css";
@@ -81,14 +78,12 @@ export default function ActivityPane(props) {
8178
const repository = props.location.pathname
8279
.split("/")[2]
8380
.replace("_", "/");
84-
const authToken =
85-
Cookies.get("gh_private_repo_token") ||
86-
Cookies.get("gh_login_token");
81+
const authToken = Cookies.get("gh_login_token");
8782
const ghRepoResponse = await axios({
8883
method: "get",
8984
url: `${githubApiDomain}/repos/${repository}`,
9085
headers: {
91-
accept: "application/json",
86+
accept: "application/vnd.github.v3+json",
9287
Authorization: `token ${authToken}`,
9388
},
9489
});
@@ -119,15 +114,6 @@ export default function ActivityPane(props) {
119114
}
120115
}, [webhookId]);
121116

122-
const handleClickConfigureWebhooks = async () => {
123-
if (!Cookies.get("gh_private_repo_token")) {
124-
Cookies.set("gh_upgrade_prev_path", window.location.pathname);
125-
window.location.href = `https://github.com/login/oauth/authorize?scope=repo&client_id=${githubPrivateRepoAccessClientID}`;
126-
} else {
127-
setOpenWebhookDialog(true);
128-
}
129-
};
130-
131117
const setSnackbar = (snackbarSeverity, snackbarText) => {
132118
setSnackbarSeverity(snackbarSeverity);
133119
setSnackbarText(snackbarText);
@@ -151,7 +137,7 @@ export default function ActivityPane(props) {
151137
<div className="configure-webhooks-control">
152138
<IoSettingsOutline
153139
className="configure-webhooks-icon"
154-
onClick={handleClickConfigureWebhooks}
140+
onClick={() => setOpenWebhookDialog(true)}
155141
/>
156142
</div>
157143
)}
@@ -165,10 +151,10 @@ export default function ActivityPane(props) {
165151
</div>
166152
)}
167153
{webhookId &&
168-
events.map((event) => {
154+
events.map((event, index) => {
169155
return (
170156
<ActivityItem
171-
key={event._id}
157+
key={index}
172158
event={event}
173159
repo={props.location.pathname.split("/")[2].replace("_", "/")}
174160
/>

client/src/components/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export default class App extends React.Component {
7171
stats: data.data
7272
})
7373
})
74-
.catch((err) => {
75-
console.log("Error logging out --->", err);
74+
.catch((error) => {
75+
console.log(error);
7676
return;
7777
});
7878
}

client/src/components/ChatWindow/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function ChatWindow(props) {
1616
{ externalCommand: "go", path: `${pathname}/?layout=embedded` },
1717
`${rcApiDomain}`
1818
);
19-
}, [pathname]);
19+
}, [props.location]);
2020
return (
2121
<div
2222
className={`chatWindow-container ${

client/src/components/ConfigureWebhook/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function ConfigureWebhook(props) {
5555
props.setSnackbar("success", "Webhook created successfully!");
5656
props.setOpenWebhookDialog(false);
5757
} catch (error) {
58-
console.log(error.response.data.errors);
58+
console.log(error);
5959
setLoading(false);
6060
props.setSnackbar("error", error.response.data.errors[0].message);
6161
}
@@ -82,7 +82,7 @@ export default function ConfigureWebhook(props) {
8282
props.setSnackbar("success", "Webhook updated successfully!");
8383
props.setOpenWebhookDialog(false);
8484
} catch (error) {
85-
console.log(error.response.data.errors);
85+
console.log(error);
8686
setLoading(false);
8787
props.setSnackbar("error", error.response.data.errors[0].message);
8888
}
@@ -110,7 +110,7 @@ export default function ConfigureWebhook(props) {
110110
props.setSnackbar("success", "Webhook deleted successfully!");
111111
props.setOpenWebhookDialog(false);
112112
} catch (error) {
113-
console.log(error.response.data.errors);
113+
console.log(error);
114114
setDeleteLoading(false);
115115
props.setSnackbar("error", error.response.data.errors[0].message);
116116
}

client/src/components/CreateChannel/index.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@
2424

2525
.repository-select-label {
2626
margin-top: 0px;
27-
}
27+
display: flex;
28+
justify-content: space-between;
29+
}
30+
31+
.install-github-app-link {
32+
color: inherit;
33+
text-decoration: underline;
34+
}

0 commit comments

Comments
 (0)