forked from MapComplete/MapComplete
		
	Fix: quickfixes to image upload flow
This commit is contained in:
		
							parent
							
								
									ce363dfb59
								
							
						
					
					
						commit
						ba1eb28f27
					
				
					 3 changed files with 12 additions and 9 deletions
				
			
		|  | @ -5,7 +5,7 @@ | |||
| 
 | ||||
|   import type { SpecialVisualizationState } from "../SpecialVisualization" | ||||
|   import { ImmutableStore, UIEventSource } from "../../Logic/UIEventSource" | ||||
|   import type { OsmTags } from "../../Models/OsmFeature" | ||||
|   import type { OsmId, OsmTags } from "../../Models/OsmFeature" | ||||
|   import LoginToggle from "../Base/LoginToggle.svelte" | ||||
|   import Translations from "../i18n/Translations" | ||||
|   import Tr from "../Base/Tr.svelte" | ||||
|  | @ -47,22 +47,25 @@ | |||
|           continue | ||||
|         } | ||||
| 
 | ||||
|         if(layer.id === "note"){ | ||||
|           const uploadResult = await state?.imageUploadManager.uploadImageWithLicense(file, tags, targetKey) | ||||
|         if(layer?.id === "note"){ | ||||
|           const uploadResult = await state?.imageUploadManager.uploadImageWithLicense(tags.data.id, | ||||
|             state.osmConnection.userDetails.data?.name ?? "Anonymous", | ||||
|             file, "image") | ||||
|           if(!uploadResult){ | ||||
|             return | ||||
|           } | ||||
|           const url = uploadResult.absoluteUrl | ||||
|           await this._osmConnection.addCommentToNote(tags.data.id, url) | ||||
|           await state.osmConnection.addCommentToNote(tags.data.id, url) | ||||
|           NoteCommentElement.addCommentTo(url, <UIEventSource<any>>tags, { | ||||
|             osmConnection: this._osmConnection, | ||||
|             osmConnection: state.osmConnection, | ||||
|           }) | ||||
|           return | ||||
|         } | ||||
| 
 | ||||
|         await state?.imageUploadManager.uploadImageAndApply(file, tags, targetKey) | ||||
|       } catch (e) { | ||||
|         alert(e) | ||||
|         console.error(e) | ||||
|         state.reportError(e, "Could not upload image") | ||||
|       } | ||||
|     } | ||||
|     errors.setData(errs) | ||||
|  |  | |||
|  | @ -88,7 +88,8 @@ export interface SpecialVisualizationState { | |||
|     readonly geocodedImages : UIEventSource<Feature[]> | ||||
| 
 | ||||
|     showCurrentLocationOn(map: Store<MlMap>): ShowDataLayer | ||||
|     reportError(message: string): Promise<void> | ||||
|     reportError(message: string | Error | XMLHttpRequest, extramessage?: string): Promise<void> | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| export interface SpecialVisualization { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue