Compare commits
21 Commits
admin-dele
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3dd24ae54d | ||
|
|
d1f42aa5cd | ||
|
|
f118ed76d1 | ||
|
|
b9cbd610a9 | ||
| daabbf80f6 | |||
| f9acefaafb | |||
| 948eff32c2 | |||
| 6de219505a | |||
| 7132a2ab45 | |||
| 5474543af4 | |||
| 6f77d03e2d | |||
| da6e7436ea | |||
| e7afac9a19 | |||
|
|
9449d3544b | ||
| 4f2e07756d | |||
|
|
f2cf7542a8 | ||
| ff7677bfb3 | |||
| 978af53a74 | |||
| a0a522f1d2 | |||
|
|
988c807af2 | ||
|
|
01b449d01d |
14
README.md
@@ -1,2 +1,14 @@
|
||||
# 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")
|
||||
.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()
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
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 |
18821
twistter-frontend/package-lock.json
generated
@@ -20,7 +20,7 @@
|
||||
"react-modal": "^3.11.1",
|
||||
"react-redux": "^7.1.1",
|
||||
"react-router-dom": "^5.1.0",
|
||||
"react-scripts": "0.9.5",
|
||||
"react-scripts": "5.0.1",
|
||||
"redux": "^4.0.4",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"typeface-roboto": "0.0.75",
|
||||
|
||||
@@ -84,23 +84,23 @@ class Writing_Microblogs extends Component {
|
||||
console.error(err);
|
||||
});
|
||||
console.log(postData.microBlogTopics);
|
||||
let topicPromises = [];
|
||||
postData.microBlogTopics.forEach(topic => {
|
||||
topicPromises.push(axios
|
||||
.post("/putTopic", {
|
||||
following: topic
|
||||
})
|
||||
.then(res => {
|
||||
console.log(res.data);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
})
|
||||
)
|
||||
});
|
||||
// let topicPromises = [];
|
||||
// postData.microBlogTopics.forEach(topic => {
|
||||
// topicPromises.push(axios
|
||||
// .post("/putTopic", {
|
||||
// following: topic
|
||||
// })
|
||||
// .then(res => {
|
||||
// console.log(res.data);
|
||||
// })
|
||||
// .catch(err => {
|
||||
// console.error(err);
|
||||
// })
|
||||
// )
|
||||
// });
|
||||
event.preventDefault();
|
||||
topicPromises.push(postPromise);
|
||||
Promise.all(topicPromises)
|
||||
// topicPromises.push(postPromise);
|
||||
Promise.all([postPromise])
|
||||
.then(() => {
|
||||
this.setState({
|
||||
value: "",
|
||||
|
||||
@@ -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])
|
||||
@@ -140,9 +154,8 @@ class Home extends Component {
|
||||
}
|
||||
|
||||
console.log(hiddenBool);
|
||||
let postMarkup = this.state.posts ? (
|
||||
// <<<<<<< admin-delete
|
||||
this.state.posts.map(post => !post.hidden && this.state.following && this.state.following.includes(post.userHandle) ? (
|
||||
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) || post.userHandle === "Admin") ? (
|
||||
<Card className={classes.card} key={post.postId}>
|
||||
<CardContent>
|
||||
<Typography>
|
||||
@@ -191,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>
|
||||
@@ -199,18 +212,6 @@ class Home extends Component {
|
||||
<p></p>
|
||||
)
|
||||
)
|
||||
// =======
|
||||
// this.state.posts.map(post =>
|
||||
// this.state.following ? (
|
||||
// this.state.following.includes(post.userHandle) ? (
|
||||
// ) : (
|
||||
// <p></p>
|
||||
// )
|
||||
// ) : (
|
||||
// <p></p>
|
||||
// )
|
||||
// >>>>>>> master
|
||||
|
||||
) : (
|
||||
<p>Loading post...</p>
|
||||
);
|
||||
|
||||
@@ -83,6 +83,10 @@ const styles = {
|
||||
wordBreak: "break-all",
|
||||
color: 'black'
|
||||
},
|
||||
dmRecentMessageDisabled: {
|
||||
wordBreak: "break-all",
|
||||
color: 'red'
|
||||
},
|
||||
dmListItemContainer: {
|
||||
height: 100
|
||||
},
|
||||
@@ -105,7 +109,7 @@ const styles = {
|
||||
fontSize: 20,
|
||||
backgroundColor: '#1da1f2',
|
||||
width: 300
|
||||
},
|
||||
},
|
||||
messagesGrid: {
|
||||
// // margin: "auto"
|
||||
// height: "auto",
|
||||
@@ -426,9 +430,15 @@ export class directMessages extends Component {
|
||||
<Typography
|
||||
className={
|
||||
this.state.selectedChannel && this.state.selectedChannel.dmId === channel.dmId ? (
|
||||
classes.dmRecentMessageSelected
|
||||
channel.hasDirectMessagesEnabled ?
|
||||
classes.dmRecentMessageSelected
|
||||
:
|
||||
classes.dmRecentMessageDisabled
|
||||
) : (
|
||||
classes.dmRecentMessageUnselected
|
||||
channel.hasDirectMessagesEnabled ?
|
||||
classes.dmRecentMessageUnselected
|
||||
:
|
||||
classes.dmRecentMessageDisabled
|
||||
)
|
||||
}
|
||||
>
|
||||
|
||||
@@ -312,7 +312,7 @@ class user extends Component {
|
||||
<Typography variant="body2">{post.body}</Typography>
|
||||
<br />
|
||||
<Typography variant="body2">
|
||||
<b>Topics:</b> {post.microBlogTopics}
|
||||
<b>Topics:</b> {post.microBlogTopics.join(", ")}
|
||||
</Typography>
|
||||
<br />
|
||||
<Typography variant="body2" color={"textSecondary"}>
|
||||
|
||||
@@ -269,6 +269,15 @@ class user extends Component {
|
||||
</Link>
|
||||
) : null;
|
||||
|
||||
let verifyButtonMarkup = this.state.profile === "Admin" ?
|
||||
<Link to="/verify">
|
||||
<Button className={classes.button} variant="outlined" color="primary">
|
||||
Verify Users
|
||||
</Button>
|
||||
</Link>
|
||||
:
|
||||
null
|
||||
|
||||
return (
|
||||
this.state.loading ? <CircularProgress size={60} style={{marginTop: "300px"}}></CircularProgress> :
|
||||
<div>
|
||||
@@ -278,6 +287,7 @@ class user extends Component {
|
||||
<Grid container>
|
||||
<Grid item sm>
|
||||
{editButtonMarkup}
|
||||
{verifyButtonMarkup}
|
||||
</Grid>
|
||||
<Grid item sm>
|
||||
{/* <Grid container direction="column"> */}
|
||||
|
||||
@@ -36,6 +36,7 @@ export const getUserData = () => (dispatch) => {
|
||||
|
||||
// Sends login data to firebase and sets the user data in Redux
|
||||
export const loginUser = (loginData, history) => (dispatch) => {
|
||||
dispatch({type: CLEAR_ERRORS});
|
||||
dispatch({ type: LOADING_UI });
|
||||
axios
|
||||
.post("/login", loginData)
|
||||
@@ -57,6 +58,7 @@ export const loginUser = (loginData, history) => (dispatch) => {
|
||||
|
||||
// Sends signup data to firebase and sets the user data in Redux
|
||||
export const signupUser = (newUserData, history) => (dispatch) => {
|
||||
dispatch({type: CLEAR_ERRORS});
|
||||
dispatch({ type: LOADING_UI });
|
||||
axios
|
||||
.post("/signup", newUserData)
|
||||
|
||||