Skip to content

Commit 9ba3967

Browse files
Events: Rename OfflineInformation to EventLocation
1 parent 29cb395 commit 9ba3967

22 files changed

Lines changed: 185 additions & 207 deletions

app/backend/src/couchers/email/emails.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ def from_proto(cls, event: events_pb2.Event) -> EventInfo:
645645
start_time=event.start_time.ToDatetime(tzinfo=UTC),
646646
end_time=event.end_time.ToDatetime(tzinfo=UTC),
647647
# Backcompat (2026-06): We might still have queued notifications referencing events with online_information.
648-
address=(event.offline_information.address or None) if event.HasField("offline_information") else None,
648+
address=(event.location.address or None) if event.HasField("location") else None,
649649
view_url=urls.event_link(occurrence_id=event.event_id, slug=event.slug),
650650
description_markdown=event.content or "",
651651
)

app/backend/src/couchers/servicers/events.py

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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:

app/backend/src/tests/test_admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ def test_DeleteEvent(db):
755755
title="Dummy Title",
756756
content="Dummy content.",
757757
photo_key=None,
758-
offline_information=events_pb2.OfflineEventInformation(
758+
location=events_pb2.EventLocation(
759759
address="Near Null Island",
760760
lat=0.1,
761761
lng=0.2,

app/backend/src/tests/test_communities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def create_event(
210210
events_pb2.CreateEventReq(
211211
title=title,
212212
content=content,
213-
offline_information=events_pb2.OfflineEventInformation(
213+
location=events_pb2.EventLocation(
214214
address="Near Null Island",
215215
lat=0.1,
216216
lng=0.2,

app/backend/src/tests/test_email.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def test_email_deleted_users_regression(db, email_collector: EmailCollector, mod
513513
content="Dummy content.",
514514
photo_key=None,
515515
parent_community_id=c_id,
516-
offline_information=events_pb2.OfflineEventInformation(
516+
location=events_pb2.EventLocation(
517517
address="Near Null Island",
518518
lat=0.1,
519519
lng=0.2,

app/backend/src/tests/test_event_log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ def test_event_created_event(db):
783783
events_pb2.CreateEventReq(
784784
title="Test Meetup",
785785
content="Let's hang out",
786-
offline_information=events_pb2.OfflineEventInformation(
786+
location=events_pb2.EventLocation(
787787
address="123 Main St",
788788
lat=0.1,
789789
lng=0.2,

0 commit comments

Comments
 (0)