-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTODO.js
92 lines (83 loc) · 4.35 KB
/
TODO.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
1. Unfriend functionality
2. Add queue to backend requests using Kue and redis
RECENTLY FIXED
- Friends list updates after removing friend
OLD CODE
// May be useful for implementing tricky one time state changes at component load
if (!prevState.username) { // Checks for previous state username false, this state logged in true, set timeout to query pending friend requests. If user was not logged in before but is logged in now, set a timeout query to get pending requests only if username is true
if (this.state.isLoggedIn) {
setTimeout((e) => {
if (!this.pendingfriendrequests) {
console.log(this.state.updateInc);
if (this.state.updateInc < 1) {
if (username) { // Only increment update state if username is set to true
console.log("Update increment state: ", this.state.updateInc);
this.setState({ updateInc: this.state.updateInc + 1 });
this.getpendingrequests("hidden", null, username);
}
}
}
}, 500)
}
} else {
if (this.state.updateInc < 1) {
if (username) {
console.log("Update increment state: ", this.state.updateInc);
this.setState({ updateInc: this.state.updateInc + 1 });
this.getpendingrequests("hidden", null, username);
}
}
}
// friends function for checking current chat length on load, useless?
componentDidMount() {
let currentchatlength;
for (let i = 0; i < this.props.conversations.length; i++) { // Determines the length of this friend chat and returns chat length
if (this.props.conversations[i].users.length == 2) {
for (let j = 0; j < this.props.conversations[i].users.length; j++) {
if (this.props.conversations[i].users[j] === this.props.friend) {
currentchatlength = this.props.conversations[i].log.length;
log(this.props.conversations[i].log.length + this.props.friend);
}
}
}
}
if (this.state.chatlength == null) {
this.setState({ chatlength: currentchatlength }); // Sets length of chat when it is equal to null at componentDidMount
}
}
// Was used for a scrolling function on early component load
// if (this.scrollRef.current.scrollHeight <= 30) { // Fixes chat that doesnt scroll down on new "typing" new load
// console.log("window just loaded early scroll");
// if (document.getElementsByClassName("friendchat-chat-container-open")[0]) {
// document.getElementsByClassName("friendchat-chat-container-open")[0].scrollBy({
// top: 1000000000,
// behavior: "smooth"
// });
// }
// }
// , async function (err, file) {
// if (!err) {
// console.log('Audio file: ' + file);
// return await {
// i: i,
// originalVideo: originalVideo,
// objUrls: createObj(objUrls.push({
// "path" : rawPath,
// "detail" : "aac"
// })),
// generatedUuid: generatedUuid,
// encodeAudio: false,
// room: room,
// body: body,
// socket: socket
// }
// // return convertVideos(i, originalVideo, objUrls, generatedUuid, false, room, body, socket);
// } else {
console.log(err);
deleteVideoArray(objUrls, originalVideo, room, 100000);
if (io) {
io.to(room).emit('uploadErr', "Something went wrong");
}
return err;
// }
// });