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

Updated deprecated API endpoint users/self to users?profile=true #931

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion __tests__/applications/applications.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Applications page', () => {
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
},
});
} else if (url === `${STAGING_API_URL}/users/self`) {
} else if (url === `${STAGING_API_URL}/users?profile=true`) {
interceptedRequest.respond({
status: 200,
contentType: 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/groups/group.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Discord Groups Page', () => {
},
body: JSON.stringify(allUsersData),
});
} else if (url === `${STAGING_API_URL}/users/self`) {
} else if (url === `${STAGING_API_URL}/users?profile=true`) {
interceptedRequest.respond({
status: 200,
contentType: 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/home/home.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Home Page', () => {
await page.setRequestInterception(true);
page.on('request', (interceptedRequest) => {
const url = interceptedRequest.url();
if (url === `${STAGING_API_URL}/users/self`) {
if (url === `${STAGING_API_URL}/users?profile=true`) {
interceptedRequest.respond({
status: 200,
contentType: 'application/json',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/task-requests/task-requestDetails.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Request container for non-super users', () => {
await page.setRequestInterception(true);
page.on('request', (interceptedRequest) => {
const url = interceptedRequest.url();
if (url == `${STAGING_API_URL}/users/self`) {
if (url == `${STAGING_API_URL}/users?profile=true`) {
interceptedRequest.respond({
...defaultMockResponseHeaders,
body: JSON.stringify(user),
Expand Down
2 changes: 1 addition & 1 deletion __tests__/user-details/task-duedate-hover.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Tasks On User Management Page', () => {
body: JSON.stringify(userDetails),
});
} else if (
url === `${STAGING_API_URL}/users/self` ||
url === `${STAGING_API_URL}/users?profile=true` ||
url === `${STAGING_API_URL}/users/ankush`
) {
interceptedRequest.respond({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {
},
body: JSON.stringify(userDetailsApi),
});
} else if (url === `${STAGING_API_URL}/users/self`) {
} else if (url === `${STAGING_API_URL}/users?profile=true`) {
// When we encounter the respective api call we respond with the below response
interceptedRequest.respond({
status: 200,
Expand Down
2 changes: 1 addition & 1 deletion __tests__/users/onboarding31days.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('Tests the "Onboarding > 31 Days" Filter', () => {
},
body: JSON.stringify(userDetailsApi),
});
} else if (url === `${STAGING_API_URL}/users/self`) {
} else if (url === `${STAGING_API_URL}/users?profile=true`) {
// When we encounter the respective api call we respond with the below response
interceptedRequest.respond({
status: 200,
Expand Down
2 changes: 1 addition & 1 deletion admin-panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const loading = document.getElementById('loading');
const selectElement = document.getElementById('select-tags');
(async function setAuth() {
try {
const res = await fetch(`${API_BASE_URL}/users/self`, {
const res = await fetch(`${API_BASE_URL}/users?profile=true`, {
method: 'GET',
credentials: 'include',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion applications/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async function getApplicationById(applicationId) {

async function getIsSuperUser() {
try {
const res = await fetch(`${BASE_URL}/users/self`, {
const res = await fetch(`${BASE_URL}/users?profile=true`, {
method: 'GET',
credentials: 'include',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion groups/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function getMembers() {
}
async function getUserSelf() {
try {
const res = await fetch(`${BASE_URL}/users/self`, {
const res = await fetch(`${BASE_URL}/users?profile=true`, {
method: 'GET',
credentials: 'include',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion identity-service-logs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function showToaster(message) {

async function getIsSuperUser() {
try {
const res = await fetch(`${API_BASE_URL}/users/self`, {
const res = await fetch(`${API_BASE_URL}/users?profile=true`, {
method: 'GET',
credentials: 'include',
headers: {
Expand Down
3 changes: 2 additions & 1 deletion mock-data/taskRequests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ const defaultMockResponseHeaders = {
};

const urlMappings = {
'https://staging-api.realdevsquad.com/users/self': superUserDetails.user,
'https://staging-api.realdevsquad.com/users?profile=true':
superUserDetails.user,
'https://api.realdevsquad.com/taskRequests/dM5wwD9QsiTzi7eG7Oq5':
individualTaskReqDetail,
'https://api.realdevsquad.com/taskRequests/dM5wwD9QsiTzi7eG7Oq6':
Expand Down
2 changes: 1 addition & 1 deletion profile/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function wantedData(data) {
}

async function getSelfUser() {
const res = await fetch(`${API_BASE_URL}/users/self`, {
const res = await fetch(`${API_BASE_URL}/users?profile=true`, {
method: 'GET',
credentials: 'include',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion taskEvents/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function getUserData(username) {
}

async function getSelfDetails() {
const res = await fetch(`${API_BASE_URL}/users/self`, {
const res = await fetch(`${API_BASE_URL}/users?profile=true`, {
method: 'GET',
credentials: 'include',
headers: {
Expand Down
4 changes: 2 additions & 2 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function goToAuthPage() {
window.open(authUrl, '_self');
}

async function getSelfUser(endpoint = '/users/self') {
async function getSelfUser(endpoint = '/users?profile=true') {
try {
const res = await fetch(`${API_BASE_URL}${endpoint}`, {
method: 'GET',
Expand All @@ -13,7 +13,7 @@ async function getSelfUser(endpoint = '/users/self') {
'Content-type': 'application/json',
},
});
if (endpoint === '/users/self') {
if (endpoint === '/users?profile=true') {
const self_user = await res.json();
if (res.status === 200) {
return self_user?.user || self_user;
Expand Down
Loading