OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
fixing eslint errors
Jonas Jabariff77a7bdbd18
diff --git a/frontend/src/app/core/apiv3/endpoints/queries/apiv3-queries-paths.ts b/frontend/src/app/core/apiv3/endpoints/queries/apiv3-queries-paths.tsindex e923a18c925..0c9be0ac4f3 100644--- a/frontend/src/app/core/apiv3/endpoints/queries/apiv3-queries-paths.ts+++ b/frontend/src/app/core/apiv3/endpoints/queries/apiv3-queries-paths.ts@@ -132,4 +132,13 @@ export class ApiV3QueriesPaths extends ApiV3ResourceCollection<QueryResource, Ap}return query.star();}-}++ /**+ * Get the ical url of the given query for the requesting user with the ical token+ *+ * @param query+ */+ public getIcalUrl(query:QueryResource):Promise<unknown> {+ return query.getIcalUrl();+ }+}\ No newline at end of filediff --git a/frontend/src/app/features/calendar/wp-calendar-page/wp-calendar-page.component.ts b/frontend/src/app/features/calendar/wp-calendar-page/wp-calendar-page.component.tsindex b884fbe9fb3..ae0d0a4f258 100644--- a/frontend/src/app/features/calendar/wp-calendar-page/wp-calendar-page.component.ts+++ b/frontend/src/app/features/calendar/wp-calendar-page/wp-calendar-page.component.ts@@ -112,7 +112,7 @@ export class WorkPackagesCalendarPageComponent extends PartitionedQuerySpacePageshow: ():boolean => this.authorisationService.can('query', 'updateImmediately'),inputs: {hideTableOptions: true,- showCalendarSharingOption: true+ showCalendarSharingOption: true,},},];diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-settings-button/wp-settings-button.component.ts b/frontend/src/app/features/work-packages/components/wp-buttons/wp-settings-button/wp-settings-button.component.tsindex 7957f7c4207..89f0f1b7bfd 100644--- a/frontend/src/app/features/work-packages/components/wp-buttons/wp-settings-button/wp-settings-button.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-settings-button/wp-settings-button.component.ts@@ -39,6 +39,7 @@ import { I18nService } from 'core-app/core/i18n/i18n.service';})export class WorkPackageSettingsButtonComponent {@Input() hideTableOptions = false;+@Input() showCalendarSharingOption = false;public text = {diff --git a/frontend/src/app/shared/components/modals/get-ical-url-modal/query-get-ical-url.modal.ts b/frontend/src/app/shared/components/modals/get-ical-url-modal/query-get-ical-url.modal.tsindex 76573738e7e..b3bf5540ad4 100644--- a/frontend/src/app/shared/components/modals/get-ical-url-modal/query-get-ical-url.modal.ts+++ b/frontend/src/app/shared/components/modals/get-ical-url-modal/query-get-ical-url.modal.ts@@ -29,13 +29,12 @@import { WorkPackagesListService } from 'core-app/features/work-packages/components/wp-list/wp-list.service';import { States } from 'core-app/core/states/states.service';import { HalResourceNotificationService } from 'core-app/features/hal/services/hal-resource-notification.service';-import { QueryResource } from 'core-app/features/hal/resources/query-resource';import { ToastService } from 'core-app/shared/components/toaster/toast.service';import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';import {- ChangeDetectorRef, Component, ElementRef, Inject, OnInit, resolveForwardRef,+ ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Inject, OnInit,} from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';@@ -44,24 +43,23 @@ import { HalResource } from 'core-app/features/hal/resources/hal-resource';@Component({templateUrl: './query-get-ical-url.modal.html',- styleUrls: ['./query-get-ical-url.modal.sass']+ styleUrls: ['./query-get-ical-url.modal.sass'],+ changeDetection: ChangeDetectionStrategy.OnPush,})export class QueryGetIcalUrlModalComponent extends OpModalComponent implements OnInit {- public query:QueryResource;-public isBusy = false;- public icalUrl: string;+ public icalUrl:string;public text = {- label_ical_sharing: this.I18n.t('js.ical_sharing_modal.title'),+ label_ical_sharing: this.I18n.t('js.ical_sharing_modal.title'),description_ical_sharing_1: this.I18n.t('js.ical_sharing_modal.description_1'),description_ical_sharing_2: this.I18n.t('js.ical_sharing_modal.description_2'),ical_sharing_warning: this.I18n.t('js.ical_sharing_modal.warning'),button_copy: this.I18n.t('js.ical_sharing_modal.copy_url_label'),copy_success_text: this.I18n.t('js.ical_sharing_modal.copy_url_success_text'),button_cancel: this.I18n.t('js.button_cancel'),- close_popup: this.I18n.t('js.close_popup_title')+ close_popup: this.I18n.t('js.close_popup_title'),};constructor(@@ -74,7 +72,7 @@ export class QueryGetIcalUrlModalComponent extends OpModalComponent implements Oreadonly wpListService:WorkPackagesListService,readonly halNotification:HalResourceNotificationService,readonly toastService:ToastService,- protected apiV3Service:ApiV3Service+ protected apiV3Service:ApiV3Service,) {super(locals, cdRef, elementRef);}@@ -82,34 +80,40 @@ export class QueryGetIcalUrlModalComponent extends OpModalComponent implements OngOnInit():void {super.ngOnInit();- this.query = this.querySpace.query.value!;+ const query = this.querySpace.query.value;++ if (!query) {+ return;+ }++ const promise = this+ .apiV3Service+ .queries+ .getIcalUrl(query);this.isBusy = true;- this- .query- .shareCalendars()+ void promise.then((response:HalResource) => {- this.icalUrl = response.icalUrl;+ this.icalUrl = String(response.icalUrl);this.isBusy = false;- this.cdRef.detectChanges();- // or would that be better?+ this.cdRef.detectChanges();+ // TODO: or would that be better?// this.ngZone.run(() => {// this.icalUrl = response.icalUrl;// this.isBusy = false;// });- })+ });}- public copyUrl($event:Event):void {+ public copyUrl():void {if (this.isBusy) {return;}- navigator.clipboard.writeText(this.icalUrl)+ void navigator.clipboard.writeText(this.icalUrl).then(() => {this.toastService.addSuccess(this.text.copy_success_text);- })-+ });}}diff --git a/frontend/src/app/shared/components/op-context-menu/handlers/op-settings-dropdown-menu.directive.ts b/frontend/src/app/shared/components/op-context-menu/handlers/op-settings-dropdown-menu.directive.tsindex 78eca9a97ce..6e86fb8f285 100644--- a/frontend/src/app/shared/components/op-context-menu/handlers/op-settings-dropdown-menu.directive.ts+++ b/frontend/src/app/shared/components/op-context-menu/handlers/op-settings-dropdown-menu.directive.ts@@ -57,6 +57,7 @@ export class OpSettingsMenuDirective extends OpContextMenuTrigger {@Input('opSettingsContextMenu-query') public query:QueryResource;@Input() public hideTableOptions:boolean;+@Input() public showCalendarSharingOption:boolean;private form:QueryFormResource;@@ -315,11 +316,11 @@ export class OpSettingsMenuDirective extends OpContextMenuTrigger {{// Calendar sharing modalhidden: !this.showCalendarSharingOption,- disabled: this.authorisationService.cannot('query', 'shareCalendars'),+ disabled: this.authorisationService.cannot('query', 'getIcalUrl'),linkText: this.I18n.t('js.toolbar.settings.share_calendar'),icon: 'icon-link', // TODO: find sharing icons- onClick: ($event:JQuery.TriggeredEvent) => {- if (this.authorisationService.can('query', 'shareCalendars')) {+ onClick: () => {+ if (this.authorisationService.can('query', 'getIcalUrl')) {this.opModalService.show(QueryGetIcalUrlModalComponent, this.injector);}diff --git a/lib/api/v3/queries/query_representer.rb b/lib/api/v3/queries/query_representer.rbindex c12f33c3b6e..4d7f8a52838 100644--- a/lib/api/v3/queries/query_representer.rb+++ b/lib/api/v3/queries/query_representer.rb@@ -147,7 +147,7 @@ module API}end- link :shareCalendars do+ link :getIcalUrl donext if represented.new_record? ||!allowed_to?(:share_via_ical)