Skip to content

Commit c0cb703

Browse files
feat: show user avatar photo (#1614)
Co-authored-by: r-p-alves <[email protected]>
1 parent 145b9e3 commit c0cb703

File tree

29 files changed

+147
-93
lines changed

29 files changed

+147
-93
lines changed

.github/workflows/tests_backend_frontend.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
3939
restore-keys: |
4040
${{ runner.os }}-npm-
41-
41+
4242
- name: Install
4343
if: steps.cache.outputs.cache-hit != 'true'
4444
run: npm ci --legacy-peer-deps
@@ -67,7 +67,7 @@ jobs:
6767
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
6868
restore-keys: |
6969
${{ runner.os }}-npm-
70-
70+
7171
- name: Install
7272
if: steps.cache.outputs.cache-hit != 'true'
7373
run: npm ci
@@ -84,10 +84,10 @@ jobs:
8484
- name: Checkout
8585
uses: actions/checkout@v4
8686

87-
- name: Use Node.js ${{ env.NODE_VERSION}}
87+
- name: Use Node.js ${{ env.NODE_VERSION }}
8888
uses: actions/setup-node@v4
8989
with:
90-
node-version: ${{ env.NODE_VERSION}}
90+
node-version: ${{ env.NODE_VERSION }}
9191
cache: "npm"
9292

9393
- name: Cache multiple paths
@@ -100,15 +100,15 @@ jobs:
100100
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
101101
restore-keys: |
102102
${{ runner.os }}-npm-
103-
103+
104104
- name: Install
105105
if: steps.cache.outputs.cache-hit != 'true'
106106
run: npm ci
107107

108108
- name: Test
109109
run: npm run test:cov
110110
working-directory: backend
111-
111+
112112
build_frontend:
113113
name: Build Frontend
114114
runs-on: ubuntu-latest
@@ -133,13 +133,15 @@ jobs:
133133
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
134134
restore-keys: |
135135
${{ runner.os }}-npm-
136-
136+
137137
- name: Install
138138
if: steps.cache.outputs.cache-hit != 'true'
139139
run: npm ci --legacy-peer-deps
140140

141141
- name: Build
142142
run: npm run build
143+
env:
144+
AZURE_STORAGE_HOSTNAME: ${{ secrets.AZURE_STORAGE_HOSTNAME }}
143145
working-directory: frontend
144146

145147
test_frontend:
@@ -150,10 +152,10 @@ jobs:
150152
- name: Checkout
151153
uses: actions/checkout@v4
152154

153-
- name: Use Node.js ${{ env.NODE_VERSION}}
155+
- name: Use Node.js ${{ env.NODE_VERSION }}
154156
uses: actions/setup-node@v4
155157
with:
156-
node-version: ${{ env.NODE_VERSION}}
158+
node-version: ${{ env.NODE_VERSION }}
157159
cache: "npm"
158160

159161
- name: Cache multiple paths
@@ -166,11 +168,13 @@ jobs:
166168
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
167169
restore-keys: |
168170
${{ runner.os }}-npm-
169-
171+
170172
- name: Install
171173
if: steps.cache.outputs.cache-hit != 'true'
172174
run: npm ci --legacy-peer-deps
173175

174176
- name: Test
175177
run: npm run jest -- --coverage
176-
working-directory: frontend
178+
env:
179+
AZURE_STORAGE_HOSTNAME: ${{ secrets.AZURE_STORAGE_HOSTNAME }}
180+
working-directory: frontend

backend/src/modules/azure/services/auth.azure.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default class AuthAzureService implements AuthAzureServiceInterface {
6868
}
6969

7070
fetchUserPhoto(userId: string) {
71-
return this.graphClient.api(`/users/${userId}/photo/$value`).get();
71+
return this.graphClient.api(`/users/${userId}/photos/240x240/$value`).get();
7272
}
7373

7474
async getADUsers(): Promise<Array<AzureUserDTO>> {

backend/src/modules/boards/repositories/board.repository.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class BoardRepository
8686
const boardDataToPopulate: PopulateOptions[] = [
8787
{
8888
path: 'createdBy',
89-
select: 'firstName lastName isDeleted',
89+
select: 'firstName lastName isDeleted avatar',
9090
match: { isDeleted: { $in: [true, false] } }
9191
},
9292
{
@@ -97,7 +97,7 @@ export class BoardRepository
9797
select: 'user role',
9898
populate: {
9999
path: 'user',
100-
select: '_id firstName lastName joinedAt isDeleted',
100+
select: '_id firstName lastName joinedAt isDeleted avatar',
101101
match: { isDeleted: { $in: [true, false] } }
102102
}
103103
}
@@ -112,7 +112,7 @@ export class BoardRepository
112112
populate: {
113113
path: 'user',
114114
model: 'User',
115-
select: 'firstName email lastName isDeleted',
115+
select: 'firstName email lastName isDeleted avatar',
116116
match: { isDeleted: { $in: [true, false] } }
117117
}
118118
}
@@ -123,7 +123,7 @@ export class BoardRepository
123123
select: 'user role -board',
124124
populate: {
125125
path: 'user',
126-
select: '_id firstName email lastName isAnonymous isDeleted',
126+
select: '_id firstName email lastName isAnonymous isDeleted avatar',
127127
match: { isDeleted: { $in: [true, false] } }
128128
}
129129
}

backend/src/modules/boards/utils/populate-board.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const BoardDataPopulate: PopulateOptions[] = [
44
{
55
path: 'users',
66
select: 'user role -board votesCount',
7-
populate: { path: 'user', select: 'firstName email lastName _id isAnonymous' }
7+
populate: { path: 'user', select: 'firstName email lastName _id isAnonymous avatar' }
88
},
99
{
1010
path: 'team',
@@ -51,7 +51,7 @@ export const GetBoardDataPopulate: PopulateOptions[] = [
5151
select: 'user role -board votesCount',
5252
populate: {
5353
path: 'user',
54-
select: 'firstName email lastName _id isAnonymous isDeleted',
54+
select: 'firstName email lastName _id isAnonymous isDeleted avatar',
5555
match: { isDeleted: { $in: [true, false] } }
5656
}
5757
},
@@ -63,34 +63,34 @@ export const GetBoardDataPopulate: PopulateOptions[] = [
6363
select: 'user role -_id',
6464
populate: {
6565
path: 'user',
66-
select: 'firstName lastName email isDeleted',
66+
select: 'firstName lastName email isDeleted avatar',
6767
match: { isDeleted: { $in: [true, false] } }
6868
}
6969
}
7070
},
7171
{
7272
path: 'columns.cards.createdBy',
73-
select: '_id firstName lastName isDeleted',
73+
select: '_id firstName lastName isDeleted avatar',
7474
match: { isDeleted: { $in: [true, false] } }
7575
},
7676
{
7777
path: 'columns.cards.comments.createdBy',
78-
select: '_id firstName lastName isDeleted',
78+
select: '_id firstName lastName isDeleted avatar',
7979
match: { isDeleted: { $in: [true, false] } }
8080
},
8181
{
8282
path: 'columns.cards.items.createdBy',
83-
select: '_id firstName lastName isDeleted',
83+
select: '_id firstName lastName isDeleted avatar',
8484
match: { isDeleted: { $in: [true, false] } }
8585
},
8686
{
8787
path: 'columns.cards.items.comments.createdBy',
88-
select: '_id firstName lastName isDeleted',
88+
select: '_id firstName lastName isDeleted avatar',
8989
match: { isDeleted: { $in: [true, false] } }
9090
},
9191
{
9292
path: 'createdBy',
93-
select: '_id firstName lastName isDeleted',
93+
select: '_id firstName lastName isDeleted avatar',
9494
match: { isDeleted: { $in: [true, false] } }
9595
},
9696
{
@@ -103,22 +103,22 @@ export const GetBoardDataPopulate: PopulateOptions[] = [
103103
export const GetCardFromBoardPopulate: PopulateOptions[] = [
104104
{
105105
path: 'columns.cards.createdBy',
106-
select: '_id firstName lastName isDeleted',
106+
select: '_id firstName lastName isDeleted avatar',
107107
match: { isDeleted: { $in: [true, false] } }
108108
},
109109
{
110110
path: 'columns.cards.comments.createdBy',
111-
select: '_id firstName lastName isDeleted',
111+
select: '_id firstName lastName isDeleted avatar',
112112
match: { isDeleted: { $in: [true, false] } }
113113
},
114114
{
115115
path: 'columns.cards.items.createdBy',
116-
select: '_id firstName lastName isDeleted',
116+
select: '_id firstName lastName isDeleted avatar',
117117
match: { isDeleted: { $in: [true, false] } }
118118
},
119119
{
120120
path: 'columns.cards.items.comments.createdBy',
121-
select: '_id firstName lastName isDeleted',
121+
select: '_id firstName lastName isDeleted avatar',
122122
match: { isDeleted: { $in: [true, false] } }
123123
}
124124
];

backend/src/modules/teams/repositories/team.repository.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class TeamRepository
2323
select: 'user role isNewJoiner canBeResponsible',
2424
populate: {
2525
path: 'user',
26-
select: '_id firstName lastName email joinedAt providerAccountCreatedAt'
26+
select: '_id firstName lastName email joinedAt providerAccountCreatedAt avatar'
2727
}
2828
}
2929
);
@@ -36,7 +36,7 @@ export class TeamRepository
3636
select: 'user role isNewJoiner canBeResponsible',
3737
populate: {
3838
path: 'user',
39-
select: '_id firstName lastName email joinedAt providerAccountCreatedAt'
39+
select: '_id firstName lastName email joinedAt providerAccountCreatedAt avatar'
4040
}
4141
}
4242
]);
@@ -49,7 +49,7 @@ export class TeamRepository
4949
select: 'user role email isNewJoiner canBeResponsible',
5050
populate: {
5151
path: 'user',
52-
select: '_id firstName lastName email joinedAt providerAccountCreatedAt'
52+
select: '_id firstName lastName email joinedAt providerAccountCreatedAt avatar'
5353
}
5454
}
5555
]);

frontend/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ AZURE_CLIENT_SECRET=
4141
# azure tenant ID
4242
AZURE_TENANT_ID=
4343

44+
#azure storage hostname
45+
AZURE_STORAGE_HOSTNAME=
46+
4447
#enable only login via sso
4548
NEXT_PUBLIC_LOGIN_SSO_ONLY=false
4649

frontend/next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ module.exports = {
2323
AZURE_CLIENT_SECRET: process.env.AZURE_CLIENT_SECRET,
2424
AZURE_TENANT_ID: process.env.AZURE_TENANT_ID,
2525
},
26+
images: {
27+
domains: [process.env.AZURE_STORAGE_HOSTNAME]
28+
},
2629
rewrites: async () => {
2730
return [
2831
{

frontend/src/components/Board/Card/CardFooter.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ const CardFooter = ({
168168
id={createdBy?._id}
169169
isDefaultColor={createdBy?._id === userId}
170170
size={20}
171+
src={createdBy?.avatar}
171172
/>
172173
<Text
173174
size="xs"

frontend/src/components/Board/Column/partials/SortMenu.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type Props = {
1414
disabled?: boolean;
1515
};
1616

17-
const SortMenu = ({ setFilter, filter, disabled }: Props) => {
17+
const SortMenu = ({ setFilter, filter, disabled = false }: Props) => {
1818
/**
1919
* Make a switch case to set icon
2020
* by current filter
@@ -64,8 +64,4 @@ const SortMenu = ({ setFilter, filter, disabled }: Props) => {
6464
);
6565
};
6666

67-
SortMenu.defaultProps = {
68-
disabled: false,
69-
};
70-
7167
export default SortMenu;

frontend/src/components/Board/Comment/PopoverSettings.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@ interface PopoverSettingsContentProps {
1616

1717
const PopoverCommentSettingsContent: React.FC<PopoverSettingsContentProps> = ({
1818
setEditCard,
19-
setDeleteCard,
19+
setDeleteCard = undefined,
2020
}) => {
21-
PopoverCommentSettingsContent.defaultProps = {
22-
setDeleteCard: undefined,
23-
};
24-
2521
return (
2622
<PopoverContent>
2723
<PopoverItem onClick={setEditCard}>
@@ -46,10 +42,7 @@ interface PopoverSettingsProps {
4642
}
4743

4844
const PopoverCommentSettings: React.FC<PopoverSettingsProps> = React.memo(
49-
({ handleEditing, handleDeleteComment }) => {
50-
PopoverCommentSettings.defaultProps = {
51-
handleDeleteComment: undefined,
52-
};
45+
({ handleEditing, handleDeleteComment = undefined }) => {
5346
return (
5447
<Popover>
5548
<PopoverTrigger size="sm" variant="dark">

0 commit comments

Comments
 (0)