Skip to content

Commit

Permalink
community: smoother services description (fixes #6001) (#7734)
Browse files Browse the repository at this point in the history
Co-authored-by: Mutugi <[email protected]>
Co-authored-by: dogi <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2024
1 parent 8de51e7 commit 3cebce4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.15.39",
"version": "0.15.40",
"myplanet": {
"latest": "v0.20.90",
"min": "v0.19.90"
Expand Down
13 changes: 11 additions & 2 deletions src/app/community/community-link-dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { CustomValidators } from '../validators/custom-validators';
import { TeamsService } from '../teams/teams.service';
import { switchMap } from 'rxjs/operators';
import { ValidatorService } from '../validators/validator.service';
import { PlanetMessageService } from '../shared/planet-message.service';

@Component({
templateUrl: './community-link-dialog.component.html',
Expand All @@ -25,6 +26,7 @@ export class CommunityLinkDialogComponent {
@Inject(MAT_DIALOG_DATA) public data: any,
private fb: FormBuilder,
private teamsService: TeamsService,
private planetMessageService: PlanetMessageService,
private validatorService: ValidatorService
) {
this.linkForm = this.fb.group({
Expand All @@ -50,10 +52,17 @@ export class CommunityLinkDialogComponent {
}

linkSubmit() {
const linkTitle = this.linkForm.get('title')?.value;
this.teamsService.createServicesLink(this.linkForm.value).pipe(
switchMap(() => this.data.getLinks())
).subscribe(() => {
this.dialogRef.close();
).subscribe({
next: () => {
this.dialogRef.close();
this.planetMessageService.showMessage(`${linkTitle} added successfully`);
},
error: () => {
this.planetMessageService.showAlert(`Error adding link`);
}
});
}

Expand Down
7 changes: 6 additions & 1 deletion src/app/community/community.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,15 @@ export class CommunityComponent implements OnInit, OnDestroy {
this.teamsService.updateTeam({ ...this.team, description: description.text }).pipe(
finalize(() => this.dialogsLoadingService.stop())
).subscribe(newTeam => {
const previousDescription = Boolean(this.team.description);
this.team = newTeam;
this.servicesDescriptionLabel = newTeam.description ? 'Edit' : 'Add';
const msg = newTeam.description
? (previousDescription ? $localize`Description edited` : $localize`Description added`)
: $localize`Description deleted`;
this.dialogsFormService.closeDialogsForm();
this.planetMessageService.showMessage(msg);
});
this.dialogsFormService.closeDialogsForm();
};
this.dialogsFormService.openDialogsForm(
this.team.description ? $localize`Edit Description` : $localize`Add Description`,
Expand Down

0 comments on commit 3cebce4

Please sign in to comment.