Compare commits

...

8 Commits

5 changed files with 44 additions and 1159 deletions

View File

@@ -1,2 +1,2 @@
# CS307-Team24
CS307 Team 24 Twistter website.
CS307 Team 24 Twistter website

View File

@@ -178,10 +178,10 @@ exports.getOtherUsersPosts = (req, res) => {
.collection("posts")
.where("userHandle", "==", req.body.handle);
post_query += admin
.firestore()
.collection("posts")
.where("microBlogTitle", "==", "Alert").where("userHandle", "==", "Admin");
// post_query += admin
// .firestore()
// .collection("posts")
// .where("microBlogTitle", "==", "Alert").where("userHandle", "==", "Admin");
post_query
.get()

View File

@@ -1,5 +1,6 @@
/* eslint-disable promise/catch-or-return */
/* eslint-disable promise/always-return */
/* eslint-disable prefer-promise-reject-error */
const { admin, db } = require("../util/admin");
const config = require("../util/config");
@@ -866,10 +867,10 @@ oneWayCheck = (userA, userB) => {
if (dmRecipient === userB) {
console.log(`You already have a DM with ${userB}`);
// reject(new Error(`You already have a DM with ${userB}`));
reject({
code: 400,
message: `You already have a DM with that user`
});
let e = new Error(`You already have a DM with that user`);
e.code = 400,
e.message = `You already have a DM with that user`
reject(e);
return;
}
});
@@ -1212,7 +1213,10 @@ exports.addSubscription = (req, res) => {
return res.status(500).json({ err });
});
// 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) => {

File diff suppressed because it is too large Load Diff

View File

@@ -57,14 +57,28 @@ class Home extends Component {
})
.catch(err => console.log(err));
let allPosts;
let postPromise = axios
.get("/getallPosts")
.then(res => {
// 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({
posts: res.data
posts: allPosts
});
})
.catch(err => console.log(err));
Promise.all([userPromise, postPromise])
@@ -141,7 +155,7 @@ class Home extends Component {
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> :
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}>
<CardContent>
<Typography>
@@ -190,7 +204,7 @@ class Home extends Component {
{/* <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>
</Card>