Skip to content

Commit

Permalink
fix(front): i#3936 add project name to notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
cocotime committed Sep 5, 2023
1 parent fe6d804 commit 2a1b49c
Show file tree
Hide file tree
Showing 86 changed files with 296 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ describe('ProjectEffects', () => {

it('Accepted Invitation', () => {
const id = randUuid();
const projectName = randName();
const user = UserMockFactory();
const username = user.username;
const effects = spectator.inject(ProjectEffects);

actions$ = hot('-a', {
a: invitationProjectActions.acceptInvitationIdSuccess({
projectId: id,
projectName,
username,
}),
});
Expand All @@ -96,6 +98,7 @@ describe('ProjectEffects', () => {
actions$ = hot('-a', {
a: invitationProjectActions.acceptInvitationIdSuccess({
projectId: id,
projectName,
username,
}),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,12 @@ export class ProjectEffects {
public acceptedInvitation$ = createEffect(() => {
return this.actions$.pipe(
ofType(invitationProjectActions.acceptInvitationIdSuccess),
tap(() => {
tap(({ projectName }) => {
this.appService.toastNotification({
message: 'invitation_accept_message',
paramsMessage: {
project: projectName,
},
status: TuiNotification.Success,
scope: 'invitation_modal',
autoClose: true,
Expand Down Expand Up @@ -240,10 +243,13 @@ export class ProjectEffects {
})
);
},
onError: (_, httpResponse: HttpErrorResponse) => {
onError: (action, httpResponse: HttpErrorResponse) => {
if (httpResponse.status === 403) {
this.appService.toastNotification({
message: 'errors.admin_permission',
paramsMessage: {
project: action.name,
},
status: TuiNotification.Error,
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ export class EditProjectComponent implements OnInit {
if (!this.project.userIsAdmin) {
this.appService.toastNotification({
message: 'errors.admin_permission',
paramsMessage: {
project: this.project.name,
},
status: TuiNotification.Error,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export class ProjectMembersComponent {
this.store.dispatch(
invitationProjectActions.acceptInvitationId({
id: this.state.get('project').id,
name: this.state.get('project').name,
})
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ export class ProjectOverviewEffects {
})
);
},
onError: (_, httpResponse: HttpErrorResponse) => {
onError: (action, httpResponse: HttpErrorResponse) => {
if (httpResponse.status === 403) {
this.appService.toastNotification({
message: 'errors.admin_permission',
paramsMessage: {
project: action.project.name,
},
status: TuiNotification.Error,
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ export class ProjectFeatureShellComponent implements OnDestroy, AfterViewInit {
this.store.dispatch(
invitationProjectActions.acceptInvitationId({
id: this.state.get('project').id,
name: this.state.get('project').name,
isBanner: true,
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ export class ProjectsSettingsFeatureSettingsComponent {
projectSlug?: Project['slug']
) {
this.appService.toastNotification({
message: 'members.no_longer_admin',
message: 'errors.admin_permission',
paramsMessage: {
project: this.state.get('project').name,
},
status: TuiNotification.Warning,
scope: 'project_settings',
closeOnNavigation: false,
});
void this.router.navigate([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export class WorkspaceDetailProjectsComponent implements OnInit {
this.setCardAmounts(event.newRect.width);
}

public acceptProjectInvite(id: string, name?: string) {
public acceptProjectInvite(id: string, name: string) {
this.store.dispatch(
invitationProjectActions.acceptInvitationId({
id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ export const invitationProjectActions = createActionGroup({
}>(),
'Accept invitation id': props<{
id: string;
name?: string;
name: string;
isBanner?: boolean;
}>(),
'Accept invitation id success': props<{
projectId: string;
projectName: string;
username: string;
}>(),
'Accept invitation id error': props<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ describe('InvitationEffects', () => {
const user = UserMockFactory();
const slug = randSlug();
const id = randUuid();
const projectName = randName();
const username = user.username;
const acceptInvitationIdMockPayload = [
{
Expand Down Expand Up @@ -131,6 +132,7 @@ describe('InvitationEffects', () => {
const expected = cold('--a', {
a: invitationProjectActions.acceptInvitationIdSuccess({
projectId: id,
projectName,
username,
}),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export class InvitationEffects {
map(([, user]) => {
return invitationProjectActions.acceptInvitationIdSuccess({
projectId: action.id,
projectName: action.name,
username: user.username,
});
})
Expand Down
3 changes: 1 addition & 2 deletions javascript/apps/taiga/src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,10 @@
"project_invitation_no_longer_valid": "The invitation to {{ name }} is no longer valid.",
"lose_story_permissions": "You no longer have permissions to {{permission}} stories",
"you_dont_have_permission_to_see": "You don't have permission to see the project.",
"admin_permission": "You are no longer admin on this project",
"admin_permission": "You are no longer admin on {{project}} project.",
"entity_no_longer_exists": "This {{entity}} no longer exists.",
"user_deleted_entity": "{{user}} has deleted it, so you cannot edit it anymore.",
"deleted_project": "Project {{name}} has been deleted.",
"generic_deleted_project": "This project has been deleted.",
"deleted_workspace": "The workspace {{name}} has been deleted."
},
"form_errors": {
Expand Down
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/ar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/bg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/ca.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/es-ES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/eu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/fa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/he.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/ja.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/ko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/pt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
15 changes: 15 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/attachments/uk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"action": "Attach file",
"title": "Attachments",
"attachments_nav": "Attachments navigation",
"collapse_attachments": "Collapse attachments",
"expand_attachments": "Expand attachments",
"column_name": "Name",
"column_date": "Date",
"column_size": "Size",
"column_actions": "Attachments actions",
"download": "Download",
"delete": "Delete",
"error_size": "The file {{filename}} has not been attached because it exceeds the maximum size of {{maxSize}}MB",
"uploading": "Uploading {{file}}"
}
3 changes: 3 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/auth/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"resend_email_label": "Sorry, something went wrong sending the email",
"resend_email_message": "Wait a few minutes and try again"
},
"warnings": {
"only_emojis": "Some people might not understand your full name correctly if it only has emojis."
},
"delete_account_success_title": "Your account was deleted successfully.",
"delete_account_success_subtitle": "👋 Sorry to see you go!"
},
Expand Down
3 changes: 3 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/auth/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"resend_email_label": "Sorry, something went wrong sending the email",
"resend_email_message": "Wait a few minutes and try again"
},
"warnings": {
"only_emojis": "Some people might not understand your full name correctly if it only has emojis."
},
"delete_account_success_title": "Your account was deleted successfully.",
"delete_account_success_subtitle": "👋 Sorry to see you go!"
},
Expand Down
3 changes: 3 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/auth/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"resend_email_label": "Sorry, something went wrong sending the email",
"resend_email_message": "Wait a few minutes and try again"
},
"warnings": {
"only_emojis": "Some people might not understand your full name correctly if it only has emojis."
},
"delete_account_success_title": "Your account was deleted successfully.",
"delete_account_success_subtitle": "👋 Sorry to see you go!"
},
Expand Down
3 changes: 3 additions & 0 deletions javascript/apps/taiga/src/assets/i18n/auth/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"resend_email_label": "Sorry, something went wrong sending the email",
"resend_email_message": "Wait a few minutes and try again"
},
"warnings": {
"only_emojis": "Some people might not understand your full name correctly if it only has emojis."
},
"delete_account_success_title": "Your account was deleted successfully.",
"delete_account_success_subtitle": "👋 Sorry to see you go!"
},
Expand Down
Loading

0 comments on commit 2a1b49c

Please sign in to comment.