Skip to content

Commit

Permalink
feat(events): set event permission on create/update
Browse files Browse the repository at this point in the history
  • Loading branch information
chillfox committed Jul 15, 2024
1 parent e90ce39 commit d85a4c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spec/controllers/events_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ describe Events do
WebMock.stub(:get, "https://graph.microsoft.com/v1.0/users/dev%40acaprojects.onmicrosoft.com/calendar/calendarView?startDateTime=2020-08-26T14%3A00%3A00-00%3A00&endDateTime=2020-08-27T13%3A59%3A59-00%3A00&%24filter=iCalUId+eq+%27040000008200E00074C5B7101A82E008000000006DE2E3761F8AD6010000000000000000100000009CCCDBB1F09DE74D8B157797D97F6A10%27&%24top=10000")
.to_return(body: File.read("./spec/fixtures/events/o365/events_query.json"))

req_body = EventsHelper.create_event_input
req_body = EventsHelper.create_event_input(permission: PlaceOS::Model::EventMetadata::Permission::PRIVATE)

event = JSON.parse(client.post(EVENTS_BASE, headers: headers, body: req_body).body).as_h
event_id = event["id"].to_s
Expand Down
6 changes: 6 additions & 0 deletions src/controllers/events.cr
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ class Events < Application
if breakdown_event_id = input_event.breakdown_event_id
meta.breakdown_event_id = breakdown_event_id
end
if permission = input_event.permission
meta.permission = permission
end
notify_created_or_updated(:create, sys, created_event, meta, can_skip: false, is_host: true)

if attending && !attending.empty?
Expand Down Expand Up @@ -590,6 +593,9 @@ class Events < Application
if breakdown_event_id = changes.breakdown_event_id
meta.breakdown_event_id = breakdown_event_id
end
if permission = changes.permission
meta.permission = permission
end
notify_created_or_updated(:update, system, updated_event, meta, can_skip: false, is_host: true)

# Grab the list of externals that might be attending
Expand Down

0 comments on commit d85a4c3

Please sign in to comment.