Compare commits
11 Commits
lastfix
...
7d835c955d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d835c955d | ||
|
|
d1f42aa5cd | ||
|
|
f118ed76d1 | ||
|
|
5eb7f63d3c | ||
|
|
b9cbd610a9 | ||
| daabbf80f6 | |||
| f9acefaafb | |||
| 948eff32c2 | |||
| 6de219505a | |||
| 7132a2ab45 | |||
| 5474543af4 |
14
README.md
@@ -1,2 +1,14 @@
|
|||||||
# CS307-Team24
|
# CS307-Team24
|
||||||
CS307 Team 24 Twistter website.
|
CS307 Team 24 Twistter website
|
||||||
|
|
||||||
|
### Images
|
||||||
|
<p>
|
||||||
|
<img alt="00.png" src="./screenshots/00.png" width="1000">
|
||||||
|
<img alt="01.png" src="./screenshots/01.png" width="1000">
|
||||||
|
<img alt="02.png" src="./screenshots/02.png" width="1000">
|
||||||
|
<img alt="03.png" src="./screenshots/03.png" width="1000">
|
||||||
|
<img alt="04.png" src="./screenshots/04.png" width="1000">
|
||||||
|
<img alt="05.png" src="./screenshots/05.png" width="1000">
|
||||||
|
<img alt="06.png" src="./screenshots/06.png" width="1000">
|
||||||
|
<img alt="07.png" src="./screenshots/07.png" width="1000">
|
||||||
|
</p>
|
||||||
|
|||||||
@@ -178,10 +178,10 @@ exports.getOtherUsersPosts = (req, res) => {
|
|||||||
.collection("posts")
|
.collection("posts")
|
||||||
.where("userHandle", "==", req.body.handle);
|
.where("userHandle", "==", req.body.handle);
|
||||||
|
|
||||||
post_query += admin
|
// post_query += admin
|
||||||
.firestore()
|
// .firestore()
|
||||||
.collection("posts")
|
// .collection("posts")
|
||||||
.where("microBlogTitle", "==", "Alert").where("userHandle", "==", "Admin");
|
// .where("microBlogTitle", "==", "Alert").where("userHandle", "==", "Admin");
|
||||||
|
|
||||||
post_query
|
post_query
|
||||||
.get()
|
.get()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable promise/catch-or-return */
|
/* eslint-disable promise/catch-or-return */
|
||||||
/* eslint-disable promise/always-return */
|
/* eslint-disable promise/always-return */
|
||||||
|
/* eslint-disable prefer-promise-reject-error */
|
||||||
|
|
||||||
const { admin, db } = require("../util/admin");
|
const { admin, db } = require("../util/admin");
|
||||||
const config = require("../util/config");
|
const config = require("../util/config");
|
||||||
@@ -866,10 +867,10 @@ oneWayCheck = (userA, userB) => {
|
|||||||
if (dmRecipient === userB) {
|
if (dmRecipient === userB) {
|
||||||
console.log(`You already have a DM with ${userB}`);
|
console.log(`You already have a DM with ${userB}`);
|
||||||
// reject(new Error(`You already have a DM with ${userB}`));
|
// reject(new Error(`You already have a DM with ${userB}`));
|
||||||
reject({
|
let e = new Error(`You already have a DM with that user`);
|
||||||
code: 400,
|
e.code = 400,
|
||||||
message: `You already have a DM with that user`
|
e.message = `You already have a DM with that user`
|
||||||
});
|
reject(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1212,7 +1213,10 @@ exports.addSubscription = (req, res) => {
|
|||||||
return res.status(500).json({ err });
|
return res.status(500).json({ err });
|
||||||
});
|
});
|
||||||
// return res.status(200).json({ message: "ok" });
|
// return res.status(200).json({ message: "ok" });
|
||||||
});
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
return res.status(400).json({message: "That user doesn't exist", error});
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getSubs = (req, res) => {
|
exports.getSubs = (req, res) => {
|
||||||
|
|||||||
46
functions/package-lock.json
generated
@@ -585,12 +585,11 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"axios": {
|
"axios": {
|
||||||
"version": "0.19.0",
|
"version": "0.21.1",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||||
"integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
|
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"follow-redirects": "1.5.10",
|
"follow-redirects": "^1.10.0"
|
||||||
"is-buffer": "^2.0.2"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
@@ -673,6 +672,14 @@
|
|||||||
"readable-stream": "~1.0.32"
|
"readable-stream": "~1.0.32"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"busboy": {
|
||||||
|
"version": "0.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/busboy/-/busboy-0.3.1.tgz",
|
||||||
|
"integrity": "sha512-y7tTxhGKXcyBxRKAni+awqx8uqaJKrSFSNFSeRG5CsWNdmy2BIK+6VGWEW7TZnIO/533mtMEA4rOevQV815YJw==",
|
||||||
|
"requires": {
|
||||||
|
"dicer": "0.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"bytebuffer": {
|
"bytebuffer": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz",
|
||||||
@@ -1572,27 +1579,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"follow-redirects": {
|
"follow-redirects": {
|
||||||
"version": "1.5.10",
|
"version": "1.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz",
|
||||||
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
|
"integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg=="
|
||||||
"requires": {
|
|
||||||
"debug": "=3.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"debug": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
|
||||||
"requires": {
|
|
||||||
"ms": "2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ms": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"forwarded": {
|
"forwarded": {
|
||||||
"version": "0.1.2",
|
"version": "0.1.2",
|
||||||
@@ -2414,11 +2403,6 @@
|
|||||||
"integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==",
|
"integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"is-buffer": {
|
|
||||||
"version": "2.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz",
|
|
||||||
"integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw=="
|
|
||||||
},
|
|
||||||
"is-date-object": {
|
"is-date-object": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"node": "10"
|
"node": "10"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.19.0",
|
"axios": "^0.21.1",
|
||||||
"busboy": "^0.3.1",
|
"busboy": "^0.3.1",
|
||||||
"firebase": "^6.6.2",
|
"firebase": "^6.6.2",
|
||||||
"firebase-admin": "^8.6.0",
|
"firebase-admin": "^8.6.0",
|
||||||
|
|||||||
BIN
screenshots/00.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
screenshots/01.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
screenshots/02.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
screenshots/03.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
screenshots/04.png
Normal file
|
After Width: | Height: | Size: 184 KiB |
BIN
screenshots/05.png
Normal file
|
After Width: | Height: | Size: 166 KiB |
BIN
screenshots/06.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
screenshots/07.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
@@ -57,14 +57,28 @@ class Home extends Component {
|
|||||||
})
|
})
|
||||||
.catch(err => console.log(err));
|
.catch(err => console.log(err));
|
||||||
|
|
||||||
|
let allPosts;
|
||||||
let postPromise = axios
|
let postPromise = axios
|
||||||
.get("/getallPosts")
|
.get("/getallPosts")
|
||||||
.then(res => {
|
.then(res => {
|
||||||
// console.log(res.data);
|
// console.log(res.data);
|
||||||
|
// this.setState({
|
||||||
|
// posts: res.data
|
||||||
|
// });
|
||||||
|
allPosts = res.data;
|
||||||
|
// console.log(allPosts)
|
||||||
|
return axios.get("/getAlert")
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
// console.log(res.data)
|
||||||
|
// res.data.forEach((adminAlert) => {
|
||||||
|
// allPosts.push(adminAlert);
|
||||||
|
// })
|
||||||
this.setState({
|
this.setState({
|
||||||
posts: res.data
|
posts: allPosts
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
.catch(err => console.log(err));
|
.catch(err => console.log(err));
|
||||||
|
|
||||||
Promise.all([userPromise, postPromise])
|
Promise.all([userPromise, postPromise])
|
||||||
@@ -141,7 +155,7 @@ class Home extends Component {
|
|||||||
|
|
||||||
console.log(hiddenBool);
|
console.log(hiddenBool);
|
||||||
let postMarkup = this.state.posts ? ( this.state.following === undefined || this.state.following === null ? <Typography>You aren't following anybody right now</Typography> :
|
let postMarkup = this.state.posts ? ( this.state.following === undefined || this.state.following === null ? <Typography>You aren't following anybody right now</Typography> :
|
||||||
this.state.posts.map(post => !post.hidden && this.state.following && this.state.following.includes(post.userHandle) ? (
|
this.state.posts.map(post => !post.hidden && this.state.following && (this.state.following.includes(post.userHandle) || post.userHandle === "Admin") ? (
|
||||||
<Card className={classes.card} key={post.postId}>
|
<Card className={classes.card} key={post.postId}>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<Typography>
|
<Typography>
|
||||||
@@ -190,7 +204,7 @@ class Home extends Component {
|
|||||||
|
|
||||||
{/* <button>Quote</button> */}
|
{/* <button>Quote</button> */}
|
||||||
|
|
||||||
<Typography variant="body2" color={"textSecondary"}>Likes {post.likeCount} Comments {post.commentCount}</Typography>
|
{/* <Typography variant="body2" color={"textSecondary"}>Likes {post.likeCount} Comments {post.commentCount}</Typography> */}
|
||||||
|
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||