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

Commit a8c452b

Browse files
committed
Removes community creation on sign up
1 parent eb33d14 commit a8c452b

2 files changed

Lines changed: 0 additions & 56 deletions

File tree

server/config/constants_example.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ const rocketChatDomain = process.env.RC_DOMAIN || "http://localhost:3000";
1515
const mongodbURI = process.env.MONGODB_URI || "mongodb://127.0.0.1/rc4git";
1616
const rc4gitApiURL =
1717
process.env.RC4GIT_API_URL || "YOUR_PUBLICLY_HOSTED_RC4GIT_API_URL";
18-
const rc4gitDomain =
19-
process.env.RC4GIT_DOMAIN || "YOUR_SELF_HOSTED_RC4GIT_CLIENT";
2018
const rc_uid = process.env.RC_UID || "ROCKET.CHAT SERVER USER ID FOR STATS";
2119
const rc_token = process.env.RC_TOKEN || "ROCKET.CHAT SERVER USER TOKEN FOR STATS";
2220
module.exports = {
@@ -33,7 +31,6 @@ module.exports = {
3331
githubPrivateRepoAccessClientID,
3432
githubPrivateRepoAccessClientSecret,
3533
rc4gitApiURL,
36-
rc4gitDomain,
3734
rc_uid,
3835
rc_token
3936
};

server/controllers/login.js

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ module.exports.createToken = async function (req, res) {
3939

4040
//Check if the user exists in our db
4141
let user = await User.findOne({ email: ghUserEmailResponse.data[0].email });
42-
// userBio acts both as a flag to see if it is a sign up and to get the user bio
43-
let userBio = "";
4442
if (!user) {
4543
//Create a new user if the user does not exist in our db
4644
const newUser = {
@@ -58,8 +56,6 @@ module.exports.createToken = async function (req, res) {
5856
newUser["name"] = ghUserResponse.data.name || ghUserResponse.data.login;
5957
newUser["username"] = `${ghUserResponse.data.login}_github`;
6058
newUser["avatarUrl"] = ghUserResponse.data.avatar_url;
61-
userBio = ghUserResponse.data.bio;
62-
6359
/*
6460
In order to handle a case when user tries signing in gets created on RC but fails get stored in our db due to some error
6561
To keep it consistent with RC we store the (user-email,encrypted-rcPassword) pair in our fs so that it can be used
@@ -132,55 +128,6 @@ module.exports.createToken = async function (req, res) {
132128
}`,
133129
});
134130

135-
//Create a user community for newly signed up user
136-
if (userBio !== "") {
137-
const headers = {
138-
"X-Auth-Token": rcLoginUserResponse.data.data.authToken,
139-
"X-User-Id": rcLoginUserResponse.data.data.userId,
140-
"Content-type": "application/json",
141-
};
142-
143-
//Create a user community on signup
144-
const rcCreateChannelResponse = await axios({
145-
method: "post",
146-
url: `${constants.rocketChatDomain}/api/v1/channels.create`,
147-
headers: headers,
148-
data: {
149-
name: user.username.slice(0, -7).concat("_community"),
150-
},
151-
});
152-
153-
await axios({
154-
method: "post",
155-
url: `${constants.rocketChatDomain}/api/v1/channels.setTopic`,
156-
headers: headers,
157-
data: {
158-
roomId: rcCreateChannelResponse.data.channel._id,
159-
topic: `GitHub: https://github.com/${user.username.slice(0, -7)}`,
160-
},
161-
});
162-
163-
// User bio fetched from GitHub can either be null or a non-empty string
164-
let description = (userBio ? userBio : "").concat(`
165-
166-
-----
167-
Embed this channel
168-
<pre><code>&lt;a&nbsp;href=&quot;${constants.rc4gitDomain}/channel/${user.username.slice(0, -7).concat("_community")}&quot;&gt;
169-
&lt;img&nbsp;src=&quot;${constants.rocketChatDomain}/images/join-chat.svg&quot;/&gt;
170-
&lt;/a&gt;</code></pre>
171-
`);
172-
173-
await axios({
174-
method: "post",
175-
url: `${constants.rocketChatDomain}/api/v1/channels.setDescription`,
176-
headers: headers,
177-
data: {
178-
roomId: rcCreateChannelResponse.data.channel._id,
179-
description: description,
180-
},
181-
});
182-
}
183-
184131
return res.status(200).json({
185132
success: true,
186133
data: {

0 commit comments

Comments
 (0)