Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Friending #425

Closed
wants to merge 176 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
d864adf
Testing friending branch
Gjidodaj02 Oct 10, 2023
cee812e
Link Friends Page
MichaelLaffan1 Oct 13, 2023
8c16d95
Merge branch 'main' into friending
MichaelLaffan1 Oct 13, 2023
83d566c
Added basic search bar
Gjidodaj02 Oct 13, 2023
f3bf2aa
Fromatting
Gjidodaj02 Oct 13, 2023
bfce6f7
Added freinds page css, start "friends-content"
Gjidodaj02 Oct 13, 2023
ca48487
Added Friend Route, Controller, Service
misacruz Oct 14, 2023
a776ca3
feat(db): Add friendships, friendship_requests, and notifications tables
youssefa123 Oct 14, 2023
84839db
Add friendships, friendship_requests, notification
youssefa123 Oct 14, 2023
5567268
Resolved merge conflicts in createDatabase.sql
youssefa123 Oct 14, 2023
5c0003f
fixed type in friendship_requests
youssefa123 Oct 14, 2023
c57c47c
updated the data types of columns that reference the user_id in the u…
youssefa123 Oct 14, 2023
551b54f
Commented out "friends-content"
Gjidodaj02 Oct 14, 2023
8f5e57a
Fix spelling in directory
MichaelLaffan1 Oct 14, 2023
f76d667
Add icons
MichaelLaffan1 Oct 14, 2023
f9e9e86
Remove commenting
MichaelLaffan1 Oct 14, 2023
1814ce7
Added send, accept, or deny request.
misacruz Oct 14, 2023
fe3b8f3
Merge branch 'friending' of https://github.com/agorafoundation/agora …
misacruz Oct 14, 2023
253992d
add-friends page added. Added title for pages
Gjidodaj02 Oct 14, 2023
a23a7f2
Merge branch 'friending' of https://github.com/agorafoundation/agora …
Gjidodaj02 Oct 14, 2023
1d44858
friends & add-friends into folders, updated routes
Gjidodaj02 Oct 14, 2023
530229f
Forgot to push
youssefa123 Oct 16, 2023
f2a4803
Merge branch 'friending' of https://github.com/briangormanly/agora in…
youssefa123 Oct 16, 2023
5aca435
Merge branch 'main' of https://github.com/agorafoundation/agora into …
Gjidodaj02 Oct 16, 2023
1b84130
Add search button
MichaelLaffan1 Oct 16, 2023
5ee2690
Updated Friend Controller for the Friend Requests
misacruz Oct 16, 2023
b62e667
Added template from dashboard to friends page
Gjidodaj02 Oct 16, 2023
e88303a
Merge branch 'friending' of https://github.com/agorafoundation/agora …
Gjidodaj02 Oct 16, 2023
4599fec
Added the friendship managment functions, Retrieve all friends for a …
youssefa123 Oct 17, 2023
1df8a11
Merge branch 'friending' of https://github.com/briangormanly/agora in…
youssefa123 Oct 17, 2023
0025c29
User Routing
MichaelLaffan1 Oct 17, 2023
0ccd527
More User Routing
MichaelLaffan1 Oct 17, 2023
0f6df89
Delete test.txt
MichaelLaffan1 Oct 17, 2023
e927e4a
Added Routes to handle response to request.
misacruz Oct 17, 2023
ee881bc
Added template for friending cards
Gjidodaj02 Oct 17, 2023
62a8bb7
Merge branch 'friending' of https://github.com/agorafoundation/agora …
Gjidodaj02 Oct 17, 2023
290228b
Add comments for grid-template questions
Gjidodaj02 Oct 18, 2023
26d65e7
Formatted, and fixed friendController
Gjidodaj02 Oct 19, 2023
5b364e8
Get username and cleanup
MichaelLaffan1 Oct 19, 2023
17bd754
Merge branch 'friending' of github.com:agorafoundation/agora into fri…
MichaelLaffan1 Oct 19, 2023
ac89f80
Add multiple username query
MichaelLaffan1 Oct 20, 2023
480f797
Formatting, added notification box on user profile
Gjidodaj02 Oct 20, 2023
5641bf8
Implemented Route, Controller, and Service
misacruz Oct 20, 2023
2a16e25
Add display user functionality
MichaelLaffan1 Oct 20, 2023
226a415
Added getAllFriendRequests, and friendRequestModal
Gjidodaj02 Oct 21, 2023
259d2ca
Added Front End ejs Files
misacruz Oct 21, 2023
d126e1d
Updated the front end to display when user sends friend request
youssefa123 Oct 21, 2023
f68f836
Merge branch 'friending' of https://github.com/briangormanly/agora in…
youssefa123 Oct 21, 2023
eee7822
Fixed the profile page
youssefa123 Oct 21, 2023
83a9060
Add Notification model with mapping utilities
youssefa123 Oct 21, 2023
f1aa403
Friend profile functionality
MichaelLaffan1 Oct 21, 2023
54cde33
Changed the model to only have the Notification class and methods rel…
youssefa123 Oct 21, 2023
94acade
Set up the notfication Controller
youssefa123 Oct 21, 2023
c4f7f67
Merge branch 'friending' of https://github.com/briangormanly/agora in…
youssefa123 Oct 21, 2023
3f98fc7
Added Files for Frontend 'Shared'
misacruz Oct 21, 2023
8aebd1a
Finished the backend for notifications
youssefa123 Oct 21, 2023
1b90e10
Friend dashboard appearance
MichaelLaffan1 Oct 21, 2023
9dfb634
Merge branch 'friending' of github.com:agorafoundation/agora into fri…
MichaelLaffan1 Oct 21, 2023
d629c8d
Wrong directory
MichaelLaffan1 Oct 22, 2023
851f148
Restored the orginal friend.js.
youssefa123 Oct 23, 2023
220cb01
Reverted to the old program to restore UI
youssefa123 Oct 23, 2023
47703aa
Fix changes
MichaelLaffan1 Oct 23, 2023
7c9151c
Formatting and searchbar
MichaelLaffan1 Oct 23, 2023
0100e4d
User Card Function
MichaelLaffan1 Oct 24, 2023
dd4b70a
Create models for friendships and requests
MichaelLaffan1 Oct 25, 2023
26f302a
Friending backend enhancements
MichaelLaffan1 Oct 26, 2023
83168a6
Added a Route and Controller
misacruz Oct 26, 2023
dcebdd6
More backend enhancements
MichaelLaffan1 Oct 26, 2023
1d702ef
Removed id
MichaelLaffan1 Oct 26, 2023
83fa44a
More backend enhancements
MichaelLaffan1 Oct 27, 2023
a9fc068
Merge remote-tracking branch 'origin/main' into friending
MichaelLaffan1 Oct 27, 2023
f112879
Merge branch 'sharing' of github.com:agorafoundation/agora into sharing
MichaelLaffan1 Oct 27, 2023
244cbc5
More backend enhancements
MichaelLaffan1 Oct 27, 2023
8e7eb30
Merge remote-tracking branch 'origin/main' into friending
MichaelLaffan1 Oct 27, 2023
032caaf
Merge remote-tracking branch 'origin/main' into sharing
MichaelLaffan1 Oct 27, 2023
868bd4f
Comment out responseHooks
MichaelLaffan1 Oct 27, 2023
f33c165
Comment out responseHooks
MichaelLaffan1 Oct 27, 2023
05932e8
Comment out responseHooks
MichaelLaffan1 Oct 27, 2023
2e20737
Update friendships table with ENUM type for status
youssefa123 Oct 27, 2023
3bbc607
Merge branch 'friending' of https://github.com/briangormanly/agora in…
youssefa123 Oct 27, 2023
1d7beb1
Modifed the backend for friendship status
youssefa123 Oct 27, 2023
4c208da
Auth user card
MichaelLaffan1 Oct 27, 2023
d057e76
More backend enhancements
MichaelLaffan1 Oct 27, 2023
36257c4
Formatting
Gjidodaj02 Oct 27, 2023
505420c
Merge branch 'friending' into friending
Gjidodaj02 Oct 28, 2023
7de3925
Updated friends page routing & grid-temp
Gjidodaj02 Oct 28, 2023
dfd52bb
experimented with adding results to workspace api result which was su…
briangormanly Oct 28, 2023
e61cd08
Updated add-friends page route
Gjidodaj02 Oct 28, 2023
2252405
Fix routing
MichaelLaffan1 Oct 28, 2023
f348f8a
Almost finished friend & manage page
Gjidodaj02 Oct 28, 2023
017fb0c
More backend enhancements
MichaelLaffan1 Oct 28, 2023
c6c7e06
Database fix
MichaelLaffan1 Oct 29, 2023
e113c8d
Fix acceptFriendRequest
MichaelLaffan1 Oct 29, 2023
51fcc72
User card functionality
MichaelLaffan1 Oct 29, 2023
0f2d31a
fixed query for getUnacceptedFriendRequests
Gjidodaj02 Oct 30, 2023
0727fc1
Deleted NotificationController for simplicity
youssefa123 Oct 30, 2023
3370c9c
Merge branch 'friending' of https://github.com/briangormanly/agora in…
youssefa123 Oct 30, 2023
69fee66
Fixed error for empty nonFriends array
Gjidodaj02 Oct 30, 2023
bfbe533
Merge branch 'friending' of https://github.com/agorafoundation/agora …
Gjidodaj02 Oct 30, 2023
b4f9697
removed console.log line, fixd no friends message
Gjidodaj02 Oct 30, 2023
e08601a
Removed anything that called NotificationController, and added css fo…
youssefa123 Oct 30, 2023
d379d08
Merge branch 'friending' of https://github.com/briangormanly/agora in…
youssefa123 Oct 30, 2023
e1430ca
Backend changes
MichaelLaffan1 Oct 30, 2023
2799279
dashboardShared Controller + Routes
misacruz Oct 30, 2023
1effeee
removed quill - should not be needed and had a security issue
briangormanly Oct 30, 2023
47c3584
Merge remote-tracking branch 'origin/main' into friending
MichaelLaffan1 Oct 30, 2023
34dc113
Formatting
misacruz Oct 31, 2023
b0e0adc
Merge branch 'main' of https://github.com/briangormanly/agora into 43…
briangormanly Oct 31, 2023
5c3e445
Merge pull request #451 from agorafoundation/437-b-brian-testing
briangormanly Oct 31, 2023
12e42c3
altered swagger ui server url to https
briangormanly Oct 31, 2023
41addd6
Merge pull request #454 from agorafoundation/453-swagger-server-url
briangormanly Oct 31, 2023
031ebec
Main and database changes
MichaelLaffan1 Oct 31, 2023
4d3dd70
Forgot files
MichaelLaffan1 Oct 31, 2023
b50e7dd
Merge main
MichaelLaffan1 Oct 31, 2023
1cc98f1
Merge main
MichaelLaffan1 Oct 31, 2023
8a7c2d7
Adding event listener to accept & deny friends
Gjidodaj02 Oct 31, 2023
8185a1d
Merge branch 'friending' of https://github.com/agorafoundation/agora …
Gjidodaj02 Oct 31, 2023
0e73fd3
routing mispell fix
Gjidodaj02 Oct 31, 2023
bead4d6
Added method to to get the details of a shared workspace by its ID, r…
youssefa123 Oct 31, 2023
e4af9d2
Merge branch 'sharing' of https://github.com/briangormanly/agora into…
youssefa123 Oct 31, 2023
f8cddf6
Edited Some Typos
misacruz Oct 31, 2023
358d1f2
Adjusted sharedEntity fields and ORM mapping
youssefa123 Oct 31, 2023
163be12
Merge branch 'sharing' of https://github.com/briangormanly/agora into…
youssefa123 Oct 31, 2023
1692f41
altered + button to create topic and resource to go with it - Started…
briangormanly Nov 1, 2023
f6f36b2
Added workspace sharing functionality
youssefa123 Nov 1, 2023
a7f73eb
Accept and deny request completed
Gjidodaj02 Nov 2, 2023
04668dc
Updated Query + Table
misacruz Nov 2, 2023
8c2834d
Added shared dahboard page
Gjidodaj02 Nov 2, 2023
05d9d75
Friend changes
MichaelLaffan1 Nov 2, 2023
e3d95cd
Merge branch 'friending' of github.com:agorafoundation/agora into fri…
MichaelLaffan1 Nov 2, 2023
453849e
Edited Query
misacruz Nov 2, 2023
ab2a534
a lot of progress, fix in for #464, lots up updates to the ui, just s…
briangormanly Nov 2, 2023
a044d84
more progress- investigating resource association with topics
briangormanly Nov 2, 2023
95891e6
Fixed Typo
youssefa123 Nov 2, 2023
0560b45
everything appears to be saving now, but the resources are not render…
briangormanly Nov 2, 2023
75acb5c
progress initial resource saves and is rendered again with you reopen…
briangormanly Nov 3, 2023
0dbeeca
Add permission level and validation to SharedEntity model
youssefa123 Nov 4, 2023
ace437e
Start delete friend
MichaelLaffan1 Nov 4, 2023
4a7c134
added dubgging statements in
briangormanly Nov 5, 2023
1f012f7
Merge pull request #466 from agorafoundation/463-fix-redo-replace-the…
briangormanly Nov 5, 2023
4c67265
Merge remote-tracking branch 'origin/main' into sharing
MichaelLaffan1 Nov 6, 2023
855aadd
Merge remote-tracking branch 'origin/main' into friending
MichaelLaffan1 Nov 6, 2023
cf3db42
Merge remote-tracking branch 'origin/main' into collab-main
MichaelLaffan1 Nov 6, 2023
0517e2f
Remove friendship_requests table
MichaelLaffan1 Nov 6, 2023
ba1f9e3
Updated shared_entity table
Gjidodaj02 Nov 6, 2023
6a7ad23
Implemented delete friend
MichaelLaffan1 Nov 6, 2023
4290e5f
Updated Table + Added Dropdown
misacruz Nov 6, 2023
f705ad5
Merge branch 'sharing' of https://github.com/agorafoundation/agora in…
Gjidodaj02 Nov 6, 2023
a731fe0
Merge branch 'sharing' of https://github.com/agorafoundation/agora in…
Gjidodaj02 Nov 6, 2023
edb270b
Finish delete friend feature
MichaelLaffan1 Nov 6, 2023
666f63d
Fix profile picture issue
MichaelLaffan1 Nov 7, 2023
5f1da50
Fix bug in add-friends
MichaelLaffan1 Nov 8, 2023
6b22470
Merge branch 'friending' of https://github.com/agorafoundation/agora …
Gjidodaj02 Nov 9, 2023
20cd8b1
Add request marker
MichaelLaffan1 Nov 9, 2023
12dc6a3
Delete friend alert and cleanup
MichaelLaffan1 Nov 10, 2023
9259257
Fix add-friends bug
MichaelLaffan1 Nov 10, 2023
257637b
Delete notifications
MichaelLaffan1 Nov 10, 2023
ee0b8d7
Add confirmations
MichaelLaffan1 Nov 10, 2023
5e7ab51
Revert "Delete notifications"
MichaelLaffan1 Nov 10, 2023
ecf7487
Updated Routes
misacruz Nov 10, 2023
36839d5
Merge remote-tracking branch 'origin/friending' into sharing
MichaelLaffan1 Nov 11, 2023
a29da20
Modifed shareWorkspace function to hopefully share a workspace
youssefa123 Nov 11, 2023
f4f26e5
Friend filter
MichaelLaffan1 Nov 12, 2023
42b9589
Testing share workspace
youssefa123 Nov 13, 2023
551ccb6
Fix share workspace request body
MichaelLaffan1 Nov 13, 2023
4ff7e7a
Share button started
Gjidodaj02 Nov 13, 2023
cc19c42
Merge branch 'sharing' of https://github.com/agorafoundation/agora in…
Gjidodaj02 Nov 13, 2023
852cc21
Update Route
Gjidodaj02 Nov 13, 2023
5a483e4
Merge remote-tracking branch 'origin/friending' into sharing
MichaelLaffan1 Nov 13, 2023
11ce62f
Merge remote-tracking branch 'origin/main' into friending
MichaelLaffan1 Nov 14, 2023
9f59daa
Merge remote-tracking branch 'origin/main' into sharing
MichaelLaffan1 Nov 14, 2023
4f774c6
Merge remote-tracking branch 'origin/main' into collab-main
MichaelLaffan1 Nov 14, 2023
63b0493
Workspace By ID
misacruz Nov 14, 2023
22d5819
Revert "Merge remote-tracking branch 'origin/main' into collab-main"
MichaelLaffan1 Nov 14, 2023
83a738d
Fix changes
MichaelLaffan1 Nov 14, 2023
ccbc53a
Merge remote-tracking branch 'origin/sharing' into friending
MichaelLaffan1 Nov 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
835 changes: 494 additions & 341 deletions client/agora/public/css/agora-theme.css

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions client/agora/public/css/topic.css
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@

.profile-status {
margin-top: 36px;
margin-left: 230px;
margin-left: 225px;
font-weight: 500px;
}

Expand Down Expand Up @@ -619,16 +619,22 @@
width: 100%;
}

.profile-status-container {
display: flex;
align-items: center;
}

.arrow {
cursor: pointer;
border: solid black;
border-width: 0 3px 3px 0;
display: inline-block;
padding: 3px;
height: 15px;
width: 15px;
padding: 1px;
height: 10px;
width: 10px;
background-color: transparent;
margin-right: 20px;
margin-top: 36px;
margin-left: 20px;
}

.arrow:focus {
Expand Down
44 changes: 44 additions & 0 deletions client/agora/public/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,50 @@
};
}

const friendsContainer = document.querySelectorAll( '#friend-card' );

function filterFriends( searchTerm ){

for ( const friend of friendsContainer ){

const friendCard = friend.outerText.toLowerCase();

if ( friendCard.includes( searchTerm.toLowerCase() ) ){
friend.style.display = 'block';
} else {

Check failure on line 1200 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1200

Closing curly brace appears on the same line as the subsequent block (brace-style)
friend.style.display = 'none';
}
}
}

function deleteFriend( friendshipId ) {
if (confirm( "Are you sure you want to remove this friend?") == true){

Check failure on line 1207 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1207

There must be a space after this paren (space-in-parens)

Check failure on line 1207 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1207

There must be a space before this paren (space-in-parens)

Check failure on line 1207 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1207

There must be a space before this paren (space-in-parens)
fetch( "/api/v1/auth/friends/deleteFriend", {
method: "DELETE",
headers: { "Content-Type": "application/json" },
body: JSON.stringify( {
"friendshipId": friendshipId,
})

Check failure on line 1213 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1213

There must be a space before this paren (space-in-parens)
})

Check failure on line 1214 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1214

There must be a space before this paren (space-in-parens)
.then( (response) => {

Check failure on line 1215 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1215

Expected indentation of 12 spaces but found 8 (indent)

Check failure on line 1215 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1215

There must be a space after this paren (space-in-parens)

Check failure on line 1215 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1215

There must be a space before this paren (space-in-parens)
if ( response.status == 200 ) {

Check failure on line 1216 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1216

Expected indentation of 16 spaces but found 12 (indent)
const message = 'Friend deleted successfully';

Check failure on line 1217 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1217

Expected indentation of 20 spaces but found 16 (indent)
console.log( message );

Check failure on line 1218 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1218

Expected indentation of 20 spaces but found 16 (indent)
alert( message );

Check failure on line 1219 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1219

Expected indentation of 20 spaces but found 16 (indent)
location.reload();

Check failure on line 1220 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1220

Expected indentation of 20 spaces but found 16 (indent)
}

Check failure on line 1221 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1221

Expected indentation of 16 spaces but found 12 (indent)
else{

Check failure on line 1222 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1222

Expected indentation of 16 spaces but found 12 (indent)
const errorMessage = 'Failed to delete friend.';

Check failure on line 1223 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1223

Expected indentation of 20 spaces but found 16 (indent)
console.error( errorMessage );

Check failure on line 1224 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1224

Expected indentation of 20 spaces but found 16 (indent)
alert( errorMessage );

Check failure on line 1225 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1225

Expected indentation of 20 spaces but found 16 (indent)
}

Check failure on line 1226 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1226

Expected indentation of 16 spaces but found 12 (indent)
})

Check failure on line 1227 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1227

Expected indentation of 12 spaces but found 8 (indent)

Check failure on line 1227 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1227

There must be a space before this paren (space-in-parens)
.catch( ( error ) => {

Check failure on line 1228 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1228

Expected indentation of 12 spaces but found 8 (indent)
console.error( 'Error deleting friend:', error);

Check failure on line 1229 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1229

Expected indentation of 16 spaces but found 12 (indent)

Check failure on line 1229 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1229

There must be a space before this paren (space-in-parens)
alert( 'Error deleting friend: ' + error );

Check failure on line 1230 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1230

Expected indentation of 16 spaces but found 12 (indent)
});

Check failure on line 1231 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1231

Expected indentation of 12 spaces but found 8 (indent)

Check failure on line 1231 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1231

There must be a space before this paren (space-in-parens)
}
};

Check failure on line 1233 in client/agora/public/js/dashboard.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/dashboard.js#L1233

Unnecessary semicolon (no-extra-semi)

// manage highlighting of control bar buttons
if( document.getElementById( "controlbar-buttons-group-1" ) ) {
Expand Down
116 changes: 116 additions & 0 deletions client/agora/public/js/friends.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Takes you to the adding friends page
const addFriendPage = () => {
window.location.href = "/friends/add-friends";
};

var displayedUsers = new Set();
const userSearch = document.getElementById( 'user-search' );
const searchButton = document.getElementById( 'btn-search' );
const friendsDashboard = document.getElementById( 'friends-dashboard' );
const redCircle = document.getElementById( 'requestCount' );
var authUser = [ ];
var friends = [ ];
var requests = [ ];

// gets the authenticated user, their friends and sent friend requests
window.onload = getResources = () => {

Check failure on line 16 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L16

'getResources' is not defined (no-undef)

fetch( "/api/v1/auth/friends/getResources", {
method: "GET",
headers: { "Content-Type": "application/json" },
} )
.then( ( response ) => response.json() )
.then( ( response ) => {
authUser.push( response[0]);

Check failure on line 24 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L24

There must be a space before this paren (space-in-parens)
friends.push( response[1] );
requests.push( response[2] );
let requestCount = response[3][0].count;
if ( requestCount > 0){

Check failure on line 28 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L28

There must be a space before this paren (space-in-parens)
let span = document.createElement("span");

Check failure on line 29 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L29

There must be a space after this paren (space-in-parens)

Check failure on line 29 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L29

There must be a space before this paren (space-in-parens)
span.textContent = requestCount;
redCircle.appendChild(span);

Check failure on line 31 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L31

There must be a space after this paren (space-in-parens)

Check failure on line 31 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L31

There must be a space before this paren (space-in-parens)
redCircle.style.display = "flex";
}
} );
};


// queries the users by username
searchButton.addEventListener( 'click', queryUsers = () => {

Check failure on line 39 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L39

'queryUsers' is not defined (no-undef)
fetch( "/api/v1/auth/user/username/" + userSearch.value, {
method: "GET",
headers: { "Content-Type": "application/json" },
} )
.then( ( response ) => response.json() )
.then( ( response ) => {

for ( i = 0; i < response.length; i++ ) {

Check failure on line 47 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L47

'i' is not defined (no-undef)

Check failure on line 47 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L47

'i' is not defined (no-undef)

Check failure on line 47 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L47

'i' is not defined (no-undef)
var data = response[i];

Check failure on line 48 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L48

'i' is not defined (no-undef)
var isFriend = false;
var isSentRequest = false;
for( j = 0; j < friends[0].length; j++ ){

Check failure on line 51 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L51

'j' is not defined (no-undef)

Check failure on line 51 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L51

'j' is not defined (no-undef)

Check failure on line 51 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L51

'j' is not defined (no-undef)
if ( ( data.username == friends[0][j].friend_username ) ){

Check failure on line 52 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L52

'j' is not defined (no-undef)
isFriend = true;
}
}
for( k = 0; k < requests[0].length; k++ ){

Check failure on line 56 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L56

'k' is not defined (no-undef)

Check failure on line 56 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L56

'k' is not defined (no-undef)

Check failure on line 56 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L56

'k' is not defined (no-undef)
if( ( data.userId == requests[0][k].initiatedby_id ) ||

Check failure on line 57 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L57

'k' is not defined (no-undef)
( data.userId == requests[0][k].recipient_id ) ){

Check failure on line 58 in client/agora/public/js/friends.js

View workflow job for this annotation

GitHub Actions / ESLint

client/agora/public/js/friends.js#L58

'k' is not defined (no-undef)
isSentRequest = true;
}
}
if ( !( displayedUsers.has( data.username ) ) &&
!( data.username == authUser[0].username ) && !( isFriend ) && !( isSentRequest ) ) {
createUserCard( data );
displayedUsers.add( data.username );
}
}
} );
} );

// creates a user card for each user
function createUserCard( userData ){
var rowDiv = document.createElement( "div" );
rowDiv.className = "row row-cols-1 row-cols-md-3 g-4";
var columnDiv = document.createElement( "div" );
columnDiv.className = "col mb-3 gallery-col align-items-stretch gallery-col";
var cardDiv = document.createElement( "div" );
cardDiv.className = "card h-100";
var cardBodyDiv = document.createElement( "div" );
cardBodyDiv.className = "card-body d-flex flex-column";
var username = document.createElement( "h5" );
username.id = userData.userId;
username.innerText = userData.username;
var userProfile = document.createElement( "img" );
userProfile.width = 225;
userProfile.src = "/assets/uploads/profile/" + userData.profileFilename;
userProfile.alt = "user's profile";
var userContainer = document.createElement( "div" );
userContainer.id = "user-container-" + userData.userId;
userContainer.style.display = "flex";
userContainer.style.marginRight = "5px";

cardBodyDiv.appendChild( username );
cardBodyDiv.appendChild( userProfile );
cardDiv.appendChild( cardBodyDiv );
columnDiv.appendChild( cardDiv );
rowDiv.append( columnDiv );
userContainer.appendChild( rowDiv );
friendsDashboard.appendChild( userContainer );


userContainer.addEventListener( 'click', sendFriendRequest = () => {
if( confirm("Are you sure you want to send a friend request to " + userData.username + "?") == true){
userContainer.style.display = "none";
fetch( "/api/v1/auth/friends/sendFriendRequest", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify ( {
"username": userData.username,
"userId": userData.userId
} )
} );
}
} );

}
72 changes: 38 additions & 34 deletions client/agora/public/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,41 @@ let sideBarStatus = true;
/**
* Triggered when the page is loaded.
*/
window.addEventListener( "load", () => {
window.addEventListener("load", () => {
// Determines whether the user is on a page that contains the sidebar
if ( document.querySelector( "#agoraSideBar" ) ) {
if (document.querySelector("#agoraSideBar")) {
loadClientSettings();

// Only add the hover events if the sidebar is not in the docked position
if ( !clientSettings.sideBarLocked ) {
if (!clientSettings.sideBarLocked) {
// add events for toggle sidebar
if( document.getElementById( "agoraSideBar" ) ) {
if (document.getElementById("agoraSideBar")) {
toggleSidebar();
document.getElementById( "agoraSideBar" ).addEventListener( "mouseenter", toggleSidebar );
document.getElementById( "agoraSideBar" ).addEventListener( "mouseleave", toggleSidebar );
document.getElementById("agoraSideBar").addEventListener("mouseenter", toggleSidebar);
document.getElementById("agoraSideBar").addEventListener("mouseleave", toggleSidebar);
}
}
if ( document.getElementById( "pin-menu" ) ) {
document.getElementById( "pin-menu" ).addEventListener( "click", lockSidebar );

if (document.getElementById("pin-menu")) {
document.getElementById("pin-menu").addEventListener("click", lockSidebar);
}
}
} );
});

/**
* Toggles the sidebar.
*/
function toggleSidebar() {
if ( !sideBarStatus ) {
document.getElementById( "agoraSideBar" ).style.width = "250px";
document.querySelector( ".dashboard-content" ).style.marginLeft = "250px";
if (!sideBarStatus) {
document.getElementById("agoraSideBar").style.width = "250px";
document.querySelector(".dashboard-content").style.marginLeft = "250px";
// document.querySelector(".friends-content").style.marginLeft = "250px";
}
else {
document.getElementById( "agoraSideBar" ).style.width = "85px";
if( window.innerWidth > 992 ) {
document.querySelector( ".dashboard-content" ).style.marginLeft = "85px";
document.getElementById("agoraSideBar").style.width = "85px";
if (window.innerWidth > 992) {
document.querySelector(".dashboard-content").style.marginLeft = "85px";
// document.querySelector(".friends-content").style.marginLeft = "85px";
}
}
sideBarStatus = !sideBarStatus;
Expand All @@ -60,23 +62,24 @@ function toggleSidebar() {
* Locks the sidebar into position.
*/
function lockSidebar() {
if ( !clientSettings.sideBarLocked ) {
document.querySelector( ".dashboard-content" ).style.marginLeft = "250px";
if (!clientSettings.sideBarLocked) {
document.querySelector(".dashboard-content").style.marginLeft = "250px";
// document.querySelector(".friends-content").style.marginLeft = "250px";

document.getElementById( "agoraSideBar" ).removeEventListener( "mouseenter", toggleSidebar );
document.getElementById( "agoraSideBar" ).removeEventListener( "mouseleave", toggleSidebar );
document.getElementById("agoraSideBar").removeEventListener("mouseenter", toggleSidebar);
document.getElementById("agoraSideBar").removeEventListener("mouseleave", toggleSidebar);

document.getElementById( "agoraSideBar" ).style.width = "250px";
document.getElementById("agoraSideBar").style.width = "250px";

document.getElementById( "tack-icon" ).style.rotate = "45deg";
document.getElementById("tack-icon").style.rotate = "45deg";

sideBarStatus = true; // important to prevent glitching when enabling/disabling the menu
}
else {
document.getElementById( "tack-icon" ).style.rotate = "0deg";
document.getElementById("tack-icon").style.rotate = "0deg";

document.getElementById( "agoraSideBar" ).addEventListener( "mouseenter", toggleSidebar );
document.getElementById( "agoraSideBar" ).addEventListener( "mouseleave", toggleSidebar );
document.getElementById("agoraSideBar").addEventListener("mouseenter", toggleSidebar);
document.getElementById("agoraSideBar").addEventListener("mouseleave", toggleSidebar);
}

clientSettings.sideBarLocked = !clientSettings.sideBarLocked;
Expand All @@ -88,21 +91,22 @@ function lockSidebar() {
* Loads the client settings from local storage and sets the properties associated with them.
*/
function loadClientSettings() {
if ( !localStorage.getItem( 'client-settings' ) ) {
if (!localStorage.getItem('client-settings')) {
saveClientSettings();
}
else {
clientSettings = JSON.parse( localStorage.getItem( 'client-settings' ) );
clientSettings = JSON.parse(localStorage.getItem('client-settings'));

if ( clientSettings.sideBarLocked ) {
document.querySelector( ".dashboard-content" ).style.marginLeft = "250px";
if (clientSettings.sideBarLocked) {
document.querySelector(".dashboard-content").style.marginLeft = "250px";
// document.querySelector(".friends-content").style.marginLeft = "250px";

document.getElementById( "agoraSideBar" ).removeEventListener( "mouseenter", toggleSidebar );
document.getElementById( "agoraSideBar" ).removeEventListener( "mouseleave", toggleSidebar );
document.getElementById("agoraSideBar").removeEventListener("mouseenter", toggleSidebar);
document.getElementById("agoraSideBar").removeEventListener("mouseleave", toggleSidebar);

document.getElementById( "agoraSideBar" ).style.width = "250px";
document.getElementById("agoraSideBar").style.width = "250px";

document.getElementById( "tack-icon" ).style.rotate = "45deg";
document.getElementById("tack-icon").style.rotate = "45deg";

sideBarStatus = true; // important to prevent glitching when enabling/disabling the menu
}
Expand All @@ -113,5 +117,5 @@ function loadClientSettings() {
* Saves the client settings to local storage.
*/
function saveClientSettings() {
localStorage.setItem( 'client-settings', JSON.stringify( clientSettings ) );
localStorage.setItem('client-settings', JSON.stringify(clientSettings));
}
43 changes: 40 additions & 3 deletions client/agora/public/js/topic-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1179,13 +1179,13 @@ if ( openTopicBtn ) {
const toggleProfileList = () => {
let arrow = document.getElementById( "profiles-toggle" );

if ( arrow.classList.contains( "down-arrow" ) ) {
if ( arrow.classList.contains( "up-arrow" ) ) {
document.getElementById( "permissions-box" ).style.display = "none";
arrow.setAttribute( 'class', 'arrow up-arrow' );
arrow.setAttribute( 'class', 'arrow down-arrow' );
}
else {
document.getElementById( "permissions-box" ).style.display = "flex";
arrow.setAttribute( 'class', 'arrow down-arrow' );
arrow.setAttribute( 'class', 'arrow up-arrow' );
}
};

Expand Down Expand Up @@ -1315,6 +1315,43 @@ const idAndFetch = () => {
}
};

const FetchShared = async () => {
console.log( "FetchShared() : Start" );
const [ isTopic, id ] = getPrefixAndId();
//console.log( isTopic, id );
if ( isTopic && id ) {
fetch( "api/v1/auth/topics/" + id, {
method: "GET",
headers: { "Content-Type": "application/json" },
} )
.then( ( response ) => response.json() )
.then( ( response ) => {
fillFields(
response.results.topicName,
response.results.topicDescription,
response.results.topicImage
);
} );
}
else if ( id ) {
//console.log( "idAndFetch() : fetch workspace" );
await fetch( "api/v1/auth/workspaces/" + id, {
method: "GET",
headers: { "Content-Type": "application/json" },
} )
.then( ( response ) => response.json() )
.then( ( response ) => {
fillFields(
response.results.workspaceName,
response.results.workspaceDescription,
response.results.workspaceImage
);
console.log( "FetchShared() : End - workspacePath" );
} );
}
console.log( "FetchShared() : End FINAL" );
};

const getTags = async () => {
const [ isTopic, id ] = getPrefixAndId();
if ( isTopic && id ) {
Expand Down
Loading
Loading