Skip to content

Feature#482#564

Closed
moses-codes wants to merge 39 commits intoTogether-100Devs:mainfrom
moses-codes:feature#482
Closed

Feature#482#564
moses-codes wants to merge 39 commits intoTogether-100Devs:mainfrom
moses-codes:feature#482

Conversation

@moses-codes
Copy link
Collaborator

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. Additionally, please include reasoning if tests have failed.

This PR includes several changes, including:

  • Expansion of Discord OAuth2 scopes to include 'guilds.members.read', in order to GET the server name of the current user (e.g. memberInfo.nick). Obtaining this information requires an additional fetch request
  • Provided initial values/fallbacks for the displayName value if global nor server nickname are available.
  • Tweaked the mock data in /server/test/unit/validateBodyBockData.js to provide a five minute buffer to event creation, in order to prevent race condition (the tests running successfully within one minute)
  • A recent push to main which removed the dotenv package (chore: remove dotenv #562) has broken one of the test suites. Jest used dotenv to read the .env variables, so the entire test suite in server/test/acceptance does not run as a result.

Type of change

Please select everything applicable. Please, do not delete any lines.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • This change requires an update to testing

Issue

Checklist:

  • This PR is up to date with the main branch, and merge conflicts have been resolved
  • I have executed npm run test and npm run test:e2e and all tests have passed successfully or I have included details within my PR on the failure.
  • I have executed npm run lint and resolved any outstanding errors. Most issues can be solved by executing npm run format
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

Copy link
Collaborator

@alcpereira alcpereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this great contribution!

To finish this work, we need some tests on this feature. At least unit tests for the isolated logic of the naming fallback, and later some e2e tests once we fix the MOCK_USER discussion.

smallestUnit: "minute",
roundingMode: "ceil",
});
const timeNow = Temporal.Now.plainTimeISO()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth adding a comment here.

profile.discriminator.length === 4
? `${profile.username}#${profile.discriminator}`
: profile.username;
// console.log('Scopes:', currentReq);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is a leftover from development.

Comment on lines 57 to 58
console.log(error);
console.log("User guild name could not be found.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(error);
console.log("User guild name could not be found.");
console.log("User guild name could not be found with the error: ", error);

);
const guildDisplayName = guildMember?.nick || profile.username;

console.log(guildDisplayName);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(guildDisplayName);

console.log("User guild name could not be found.");
}

const guildMember = profile.guilds.find(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it the same thing as is100Dever?

}
);
const devMemberData = await devMemberInfo.json();
// console.log(devMemberData.nick, devMemberData.user)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// console.log(devMemberData.nick, devMemberData.user)

: profile.username;
// console.log('Scopes:', currentReq);

let displayName = profile.global_name ?? profile.username;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to document this whole bit of code, or even move it to its own function.

If I understand correctly there are:

  • profile.global_name: Regular "Display Name" in Discord (My Accounts tab)
  • profile.username: Full Discord username (My Accounts tab)
  • devMemberData.nick: A specific Discord nickname for the server (Profiles > Per- server Profiles tab)

If the user is not from 100devs, we should not even fetch the endpoint users/@me/guilds/735923219315425401/member

Make it clear about the logic of the fallback, I guess it should be (Server nick > Display Name > User name).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I think of it, this definitely needs documentation and tests!

// console.log(devMemberData.nick, devMemberData.user)
if (devMemberData.nick) {
displayName = devMemberData.nick;
} else if (profile.discriminator.length === 4) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been deprecated in 2024 (here). We can completely remove this bit of code.

emmebravo and others added 23 commits June 30, 2025 12:39
bump packages that won't break production; removed package and updated files using said package
check if user is moderator, allow to delete any event

API unit tests

add verification of deleting to integration test

add unit tests

add unit test for non moderator to delete their own event

add moderator to discord mocking

clear db

refactor: change cra to vite and monorepo setup

typo: to have been called with

add passport discord mocking to routes tests

add is moderator flag to mocked moderator

refactor for preventing non moderator deletion test

refactors

add moderator logic to passport

add ismoderator flag to passport discord mocking

flip moderator logic

update tests

Updated the landing page 'Contributing Together' portion.

fix: callback auth path issue

export responses from passport discord mocking

passport call mock discord responses

create test users in the tests

map auth headers to database users

passport discord mocking call directly again

remove logs from events.js

remove ismoderator flag from pasport discort mocking

add frontend validation

fix: remove spaces in .env.example keys

add isModerator flag to mock user

passport: set profile to false, remove update ismoderator status

event modal: update variable name

add comment to server/middleware/auth.js

Co-authored-by: alcpereira <48070464+alcpereira@users.noreply.github.com>

remove bla bla
Add trust proxy setting to enable HTTPS detection behidn Fly.io proxy.

Fixes issue Together-100Devs#466
This reverts commit d40983b which had reverted the original cookie max age feature.
The cookie max age functionality is needed for proper session management.

Addresses issue Together-100Devs#599
add intelagense to codeowners
move the help text from the wiki to the docs
Delete client/src/setupProxy.js

Added title and aria-label attributes to CalendarHeader.jsx

Revert "Added title and aria-label attributes to CalendarHeader.jsx"

This reverts commit 39c52a6.

client/src/features/calendarHeader/CalendarHeader.jsx reverted adding
title/aria-label attributes to calendarHeader.jsx

Remove http-proxy-middleware from client and update codebase

Undo title and aria-label changes for CalendarHeader.jsx
adel-abdulazeem and others added 15 commits August 12, 2025 13:12
Complete requested changes

Edit Discord 0Auth2 Docs

Edit Discord 0Auth2 Docs

Fixed button screenshot

Trying to get image to load correctly

Finish Discord 0Auth2 Setup instructions

Note to check login

Fix redirect button image

Fix localhost link
made sure that only title will be visible for mobile with truncate and
ellapsis
changes Co-authored-by: Devin Lane <devin.c.lane@gmail.com>
changed constant for reccurring days

destructured constant coreectly

adjusted e2e test createform

changed note text on form regardding recurring events

cleaned up variable names and xport of constants

removed empty space

added JSDOC to constants.js

feature 531 corrected JSDOC implementation
@DevinCLane
Copy link
Collaborator

This conversation has moved over to #658, so i'm closing this PR

@DevinCLane DevinCLane closed this Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change displayName in OAuth strategy