@@ -149,15 +149,15 @@ def event_to_pb(session: Session, occurrence: EventOccurrence, context: Couchers
149149 )
150150 ).scalar_one ()
151151
152- offline_information : events_pb2 .OfflineEventInformation
152+ location : events_pb2 .EventLocation
153153 if occurrence .geom :
154- offline_information = events_pb2 .OfflineEventInformation (
154+ location = events_pb2 .EventLocation (
155155 lat = not_none (occurrence .coordinates )[0 ], lng = not_none (occurrence .coordinates )[1 ], address = occurrence .address
156156 )
157157 else :
158158 # Backcompat: Surface legacy online events as offline events.
159159 # They'll appear at null island, but there are so few we're ok with this.
160- offline_information = events_pb2 .OfflineEventInformation (address = occurrence .link , lat = 0 , lng = 0 )
160+ location = events_pb2 .EventLocation (address = occurrence .link , lat = 0 , lng = 0 )
161161
162162 return events_pb2 .Event (
163163 event_id = occurrence .id ,
@@ -169,7 +169,7 @@ def event_to_pb(session: Session, occurrence: EventOccurrence, context: Couchers
169169 content = occurrence .content ,
170170 photo_url = occurrence .photo .full_url if occurrence .photo else None ,
171171 photo_key = occurrence .photo_key or "" ,
172- offline_information = offline_information ,
172+ location = location ,
173173 created = Timestamp_from_datetime (occurrence .created ),
174174 last_edited = Timestamp_from_datetime (occurrence .last_edited ),
175175 creator_user_id = occurrence .creator_user_id ,
@@ -404,16 +404,13 @@ def CreateEvent(
404404
405405 # As protobuf parses a missing value as 0.0, this is not a permitted event coordinate value
406406 if not (
407- request .HasField ("offline_information" )
408- and request .offline_information .address
409- and request .offline_information .lat
410- and request .offline_information .lng
407+ request .HasField ("location" ) and request .location .address and request .location .lat and request .location .lng
411408 ):
412409 context .abort_with_error_code (grpc .StatusCode .INVALID_ARGUMENT , "missing_event_address_or_location" )
413- if request .offline_information .lat == 0 and request .offline_information .lng == 0 :
410+ if request .location .lat == 0 and request .location .lng == 0 :
414411 context .abort_with_error_code (grpc .StatusCode .INVALID_ARGUMENT , "invalid_coordinate" )
415- geom = create_coordinate (request .offline_information .lat , request .offline_information .lng )
416- address = request .offline_information .address
412+ geom = create_coordinate (request .location .lat , request .location .lng )
413+ address = request .location .address
417414
418415 start_time = to_aware_datetime (request .start_time )
419416 end_time = to_aware_datetime (request .end_time )
@@ -538,16 +535,13 @@ def ScheduleEvent(
538535 if not request .content :
539536 context .abort_with_error_code (grpc .StatusCode .INVALID_ARGUMENT , "missing_event_content" )
540537 if not (
541- request .HasField ("offline_information" )
542- and request .offline_information .address
543- and request .offline_information .lat
544- and request .offline_information .lng
538+ request .HasField ("location" ) and request .location .address and request .location .lat and request .location .lng
545539 ):
546540 context .abort_with_error_code (grpc .StatusCode .INVALID_ARGUMENT , "missing_event_address_or_location" )
547- if request .offline_information .lat == 0 and request .offline_information .lng == 0 :
541+ if request .location .lat == 0 and request .location .lng == 0 :
548542 context .abort_with_error_code (grpc .StatusCode .INVALID_ARGUMENT , "invalid_coordinate" )
549- geom = create_coordinate (request .offline_information .lat , request .offline_information .lng )
550- address = request .offline_information .address
543+ geom = create_coordinate (request .location .lat , request .location .lng )
544+ address = request .location .address
551545
552546 start_time = to_aware_datetime (request .start_time )
553547 end_time = to_aware_datetime (request .end_time )
@@ -663,15 +657,13 @@ def UpdateEvent(
663657 if request .HasField ("photo_key" ):
664658 occurrence_update ["photo_key" ] = request .photo_key .value
665659
666- if request .HasField ("offline_information " ):
660+ if request .HasField ("location " ):
667661 notify_updated .append (notification_data_pb2 .EventUpdateItem .EVENT_UPDATE_ITEM_LOCATION )
668662 occurrence_update ["link" ] = None
669- if request .offline_information .lat == 0 and request .offline_information .lng == 0 :
663+ if request .location .lat == 0 and request .location .lng == 0 :
670664 context .abort_with_error_code (grpc .StatusCode .INVALID_ARGUMENT , "invalid_coordinate" )
671- occurrence_update ["geom" ] = create_coordinate (
672- request .offline_information .lat , request .offline_information .lng
673- )
674- occurrence_update ["address" ] = request .offline_information .address
665+ occurrence_update ["geom" ] = create_coordinate (request .location .lat , request .location .lng )
666+ occurrence_update ["address" ] = request .location .address
675667
676668 if request .HasField ("start_time" ) or request .HasField ("end_time" ):
677669 if request .update_all_future :
0 commit comments