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
Don't fire on same value
Oliver Günther53aab51fd295
diff --git a/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.html b/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.htmlindex 5afe822ca98..e6067ca49e5 100644--- a/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.html+++ b/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.html@@ -4,6 +4,7 @@*ngIf="inputName && !(multiple && multipleAsSeparateInputs)"type="hidden"[attr.name]="inputName"+ [value]="mappedInputValue"[attr.data-action]="hiddenFieldAction"><ng-container *ngIf="multiple && multipleAsSeparateInputs"><inputdiff --git a/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts b/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.tsindex 2918da65c4a..b61ff7a010e 100644--- a/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts+++ b/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts@@ -200,7 +200,7 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocomplet@Input() public selectableGroupAsModel?:boolean = true;- @Input() public searchFn:(term:string, item:any) => boolean;+ @Input() public searchFn:(term:string, item:unknown) => boolean;@Input() public trackByFn = this.defaultTrackByFunction();@@ -319,17 +319,6 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocompletif (this.items) {this.items$.next(this.items as IOPAutocompleterOption[]);}-- if (this.inputValue && this.resource && !this.model) {- this- .opAutocompleterService- .loadValue(this.inputValue, this.resource, this.multiple)- .subscribe((resource) => {- this.model = resource as unknown as T;- this.syncHiddenField(this.mappedInputValue);- this.cdRef.detectChanges();- });- }}ngOnChanges(changes:SimpleChanges):void {@@ -343,6 +332,17 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocompletthis.syncHiddenField(this.mappedInputValue);}+ if (this.inputValue && this.resource && !this.model) {+ this+ .opAutocompleterService+ .loadValue(this.inputValue, this.resource, this.multiple)+ .subscribe((resource) => {+ this.model = resource as unknown as T;+ this.syncHiddenField(this.mappedInputValue);+ this.cdRef.detectChanges();+ });+ }+this.ngZone.runOutsideAngular(() => {setTimeout(() => {this.results$ = merge(@@ -385,7 +385,7 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocompletthis.open.emit();}- public getOptionsItems(searchKey:string):Observable<any> {+ public getOptionsItems(searchKey:string):Observable<unknown> {return of((this.items as IOPAutocompleterOption[])?.filter((element) => element.name.includes(searchKey)));}@@ -414,6 +414,7 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocompletthis.onTouched(val);this.onChange(val);this.syncHiddenField(this.mappedInputValue);+ this.syncedInput?.nativeElement.dispatchEvent(new Event('change'));this.change.emit(val);if (this.resetOnChange) {@@ -592,13 +593,19 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocomplet);}- protected syncHiddenField(mappedInputValue:string|string[]) {+ protected syncHiddenField(mappedInputValue:string|string[]):void {const input = this.syncedInput?.nativeElement;- if (input) {- input.value = Array.isArray(mappedInputValue) ? mappedInputValue.join(',') : mappedInputValue;- const event = new Event('change');- input.dispatchEvent(event);+ if (!input) {+ return;}++ const newValue = Array.isArray(mappedInputValue) ? mappedInputValue.join(',') : mappedInputValue;+ // Don't fire a change event if the value is the same+ if (input.value === newValue) {+ return;+ }++ input.value = newValue;}public addNewObjectFn(searchTerm:string):unknown {diff --git a/modules/costs/spec/features/timer_spec.rb b/modules/costs/spec/features/timer_spec.rbindex d3260ffda5e..5dbfd03edc1 100644--- a/modules/costs/spec/features/timer_spec.rb+++ b/modules/costs/spec/features/timer_spec.rb@@ -100,7 +100,7 @@ RSpec.describe "Work Package timer", :js, :selenium doexpect(timer_entry.work_package).to eq work_package_aexpect(timer_entry.hours).to be_nil- page.within(".spot-modal") { click_button "Stop current timer" }+ page.within(".spot-modal") { click_on "Stop current timer" }time_logging_modal.is_visible truetime_logging_modal.has_field_with_value "spent_on", Date.current.strftimetime_logging_modal.has_field_with_value "hours", /(\d\.)?\d+/diff --git a/spec/features/support/components/time_logging_modal.rb b/spec/features/support/components/time_logging_modal.rbindex 7af5d8704fd..3aeea699214 100644--- a/spec/features/support/components/time_logging_modal.rb+++ b/spec/features/support/components/time_logging_modal.rb@@ -38,7 +38,7 @@ module Componentsdef is_visible(visible)if visiblewithin modal_container do- expect(page).to have_text(I18n.t("button_log_time"))+ expect(page).to have_button(I18n.t("button_log_time"))endelseexpect(page).to have_no_css "dialog#time-entry-dialog"