Skip to content

Commit 859b2e4

Browse files
authored
Automatically remove meetups if they are cancelled or removed (#743)
1 parent 2b7bb59 commit 859b2e4

12 files changed

+145
-26
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Extra keys for the upcoming events:
6060
* `cfp_open_date`: The date when the CFP was opened - ISO8601 formatted (yyyy-mm-dd).
6161
* `cfp_close_date`: If there is a CFP deadline, enter that here - ISO8601 formatted (yyyy-mm-dd).
6262
* `cfp_link`: A link to the CFP submission page.
63-
* `status`: Typically you want to put "Canceled", "Postponed" or "To be announced" here.
63+
* `status`: Typically you want to put "Cancelled", "Postponed" or "To be announced" here.
6464
* `date_precision`: Controls the precision of the `start_date` and `end_date` when the conference dates aren't announced just yet but it's confirmed that the conference is happening. Possible values: `full` (implicit default), `month` or `year`. The `start_date` and `end_date` fields still need to be fully formatted ISO8601 dates, you can put the last day of the month/year in it so it also gets ordered properly.
6565
* `announced_on`: The date on which the conference was announced - ISO8601 formatted (yyyy-mm-dd). This date is used as the publish date for the [RSS feed](https://rubyconferences.org/feed.xml) so people can stay up to date with newly announced conferences.
6666

@@ -87,6 +87,7 @@ Here is a list of the keys that can be used:
8787
* ZZZ - timezone (e.g. CDT or EST)
8888
* `end_time`: The end time of the event - ISO8601 formatted as (hh:mm:ss ZZZ) using same values as `start_time`
8989
* `url`: The url for the event.
90+
* `status`: Typically you want to put "Cancelled" or "Postponed" here.
9091

9192
## Getting started
9293

Rakefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ task :verify_meetups do
6060
"url",
6161
"twitter",
6262
"mastodon",
63-
"video_link"
63+
"video_link",
64+
"status"
6465
]
6566
data = YAML.load_file("_data/meetups.yml", permitted_classes: [Date])
6667
validator = DataFileValidator.validate(data, allowed_keys, :meetup)

_data/conferences.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1876,15 +1876,15 @@
18761876
end_date: 2020-03-22
18771877
url: https://2020.wrocloverb.com
18781878
twitter: wrocloverb
1879-
status: Canceled
1879+
status: Cancelled
18801880

18811881
- name: Ruby Retreat NZ 2020
18821882
location: Mt Cheeseman, near Christchurch, New Zealand
18831883
url: https://retreat.ruby.nz
18841884
start_date: 2020-03-27
18851885
end_date: 2020-03-30
18861886
twitter: RubyNewZealand
1887-
status: Canceled
1887+
status: Cancelled
18881888

18891889
- name: Ruby by the Bay (Ruby for Good)
18901890
location: Sausalito, CA
@@ -1906,7 +1906,7 @@
19061906
end_date: 2020-04-26
19071907
url: https://rubyconfindia.org
19081908
twitter: rubyconfindia
1909-
status: Canceled
1909+
status: Cancelled
19101910

19111911
- name: RailsConf 2020.2 Couch Edition
19121912
location: Your Couch
@@ -1922,7 +1922,7 @@
19221922
end_date: 2020-05-16
19231923
url: https://balkanruby.com
19241924
twitter: balkanruby
1925-
status: Canceled
1925+
status: Cancelled
19261926

19271927
- name: Pivorak Conf. 5.0
19281928
location: Online
@@ -1938,15 +1938,15 @@
19381938
end_date: 2020-06-07
19391939
url: https://2020.rubyunconf.eu/
19401940
twitter: rubyunconfeu
1941-
status: Canceled
1941+
status: Cancelled
19421942

19431943
- name: Saint P Rubyconf 2020
19441944
location: Saint Petersburg, Russia
19451945
start_date: 2020-06-06
19461946
end_date: 2020-06-07
19471947
url: https://spbrubyconf.ru/
19481948
twitter: saintpruby
1949-
status: Canceled
1949+
status: Cancelled
19501950

19511951
- name: Brighton Ruby 2020
19521952
location: Online
@@ -1962,7 +1962,7 @@
19621962
end_date: 2020-07-17
19631963
url: https://rubyness.org/
19641964
twitter: rubynessconf
1965-
status: Canceled
1965+
status: Cancelled
19661966

19671967
- name: RubyConfBY
19681968
location: Online
@@ -1994,7 +1994,7 @@
19941994
end_date: 2020-09-13
19951995
url: https://rubyc.eu/
19961996
twitter: rubyc_eu
1997-
status: Canceled
1997+
status: Cancelled
19981998

19991999
- name: RubyDay
20002000
location: Online
@@ -2027,7 +2027,7 @@
20272027
end_date: 2020-10-17
20282028
url: https://rubyconfth.com/
20292029
twitter: rubyconfth
2030-
status: Canceled
2030+
status: Cancelled
20312031

20322032
- name: ROSS conf
20332033
location: Online
@@ -2681,7 +2681,7 @@
26812681
url: https://west.railscamp.us/2024
26822682
twitter: railscamp_usa
26832683
announced_on: 2024-02-29
2684-
status: Canceled
2684+
status: Cancelled
26852685

26862686
- name: Fukuoka RubyistKaigi 04
26872687
location: Fukuoka, Japan
@@ -2753,7 +2753,7 @@
27532753
cfp_open_date: 2023-12-05
27542754
cfp_close_date: 2024-08-10
27552755
cfp_link: https://www.papercall.io/rubyfuza-2024
2756-
status: Canceled
2756+
status: Cancelled
27572757
announced_on: 2023-10-18
27582758

27592759
- name: Ruby Retreat 2024

_data/meetups.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,7 @@
13441344
start_time: 11:00:00 IST
13451345
end_time: 13:00:00 IST
13461346
url: https://www.meetup.com/punerubymeetup/events/302884102
1347+
status: cancelled
13471348

13481349
- name: Orange County Ruby Users Group - Ruby Science September 2024
13491350
location: Online
@@ -1456,6 +1457,7 @@
14561457
start_time: 19:00:00 EDT
14571458
end_time: 21:00:00 EDT
14581459
url: https://www.meetup.com/bmore-on-rails/events/302969766
1460+
status: cancelled
14591461

14601462
- name: Philly.rb - Pubnite September 2024
14611463
location: Online
@@ -1822,7 +1824,8 @@
18221824
date: 2024-10-08
18231825
start_time: 19:00:00 EDT
18241826
end_time: 21:00:00 EDT
1825-
url: https://www.meetup.com/bmore-on-rails/events/rkzbjsygcnblb
1827+
url: https://www.meetup.com/bmore-on-rails/events/303140069
1828+
status: cancelled
18261829

18271830
- name: Philly.rb - Pubnite October 2024
18281831
location: Online
@@ -2152,7 +2155,8 @@
21522155
date: 2024-11-12
21532156
start_time: 19:00:00 EDT
21542157
end_time: 21:00:00 EDT
2155-
url: https://www.meetup.com/bmore-on-rails/events/rkzbjsygcpbqb
2158+
url: https://www.meetup.com/bmore-on-rails/events/303140100
2159+
status: cancelled
21562160

21572161
- name: Philly.rb - Pubnite November 2024
21582162
location: Online
@@ -2433,7 +2437,8 @@
24332437
date: 2024-12-10
24342438
start_time: 19:00:00 EDT
24352439
end_time: 21:00:00 EDT
2436-
url: https://www.meetup.com/bmore-on-rails/events/rkzbjsygcqbnb
2440+
url: https://www.meetup.com/bmore-on-rails/events/303140116
2441+
status: cancelled
24372442

24382443
- name: Philly.rb - Pubnite December 2024
24392444
location: Online

_includes/meetup.html

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
{% else %}
55
<a>{{ meetup.name }}</a>
66
{% endif %}
7+
8+
{% if meetup.status %}
9+
<div class="status" data-phrase="{{ meetup.status }}"></div>
10+
{% endif %}
711
</dt>
812

913
<dd>

src/events/abstract_event.rb

+5
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def meetup_file_entry
5454
end_time: [event_end_time.strftime("%H:%M:%S"), tz.now.strftime("%Z")].join(" "),
5555
url: event_url,
5656
group: group,
57+
status: event_status
5758
)
5859
end
5960

@@ -65,6 +66,10 @@ def event_date
6566
event_start_time.to_date
6667
end
6768

69+
def event_status
70+
nil
71+
end
72+
6873
def event_name
6974
raise "Must implement event_name"
7075
end

src/events/meetup_event.rb

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ def event_url
1919
object.eventUrl
2020
end
2121

22+
def event_status
23+
object.status == "published" ? nil : object.status
24+
end
25+
2226
def event_location
2327
city = object.dig("venue", "city") || object.dig("group", "city")
2428
state = object.dig("venue", "state") || object.dig("group", "state")

src/meetup_graphql_schema.json

+43-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"args": []
8484
},
8585
{
86-
"name": "unifiedEvents",
86+
"name": "upcomingEvents",
8787
"type": {
8888
"kind": "OBJECT",
8989
"name": "EventConnection"
@@ -95,6 +95,20 @@
9595
"kind": "ENUM",
9696
"name": "SortOrder"
9797
}
98+
},
99+
{
100+
"name": "input",
101+
"type": {
102+
"kind": "INPUT_OBJECT",
103+
"name": "ConnectionInput"
104+
}
105+
},
106+
{
107+
"name": "filter",
108+
"type": {
109+
"kind": "INPUT_OBJECT",
110+
"name": "GroupUpcomingEventsFilter"
111+
}
98112
}
99113
]
100114
}
@@ -163,6 +177,34 @@
163177
}
164178
]
165179
},
180+
{
181+
"kind": "INPUT_OBJECT",
182+
"name": "GroupUpcomingEventsFilter",
183+
"inputFields": [
184+
{
185+
"name": "includeCancelled",
186+
"type": {
187+
"kind": "SCALAR",
188+
"name": "Boolean"
189+
},
190+
"args": []
191+
}
192+
]
193+
},
194+
{
195+
"kind": "INPUT_OBJECT",
196+
"name": "ConnectionInput",
197+
"inputFields": [
198+
{
199+
"name": "first",
200+
"type": {
201+
"kind": "SCALAR",
202+
"name": "Int"
203+
},
204+
"args": []
205+
}
206+
]
207+
},
166208
{
167209
"kind": "OBJECT",
168210
"name": "EventEdge",

src/meetups_file.rb

+35
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def initialize(content:)
1919
@new_events = []
2020
@updated_events = []
2121
@removed_events = []
22+
@cancelled_events = []
2223
end
2324

2425
def find_by(service_id: nil, url: nil)
@@ -40,6 +41,16 @@ def fetch_group!(group)
4041
puts "New Meetup: #{event.name} - #{event.date}"
4142
end
4243

44+
group.cancelled_events.map { |event| event.meetup_file_entry }.each do |event|
45+
event_entry = find_by(url: event.url)
46+
47+
if event_entry && event != event_entry
48+
@cancelled_events << event
49+
@events[@events.index(event_entry)] = event
50+
puts "Cancelled Meetup: #{event.name} - #{event.date}"
51+
end
52+
end
53+
4354
group.upcoming_events.map { |event| event.meetup_file_entry }.each do |event|
4455
event_entry = find_by(url: event.url)
4556

@@ -50,6 +61,12 @@ def fetch_group!(group)
5061
end
5162
end
5263

64+
group.missing_events.map { |event| MeetupsFileEntry.from_yaml_item(event) }.each do |event|
65+
@removed_events << event
66+
@events.delete(event)
67+
puts "Removed Meetup: #{event.name} - #{event.date}"
68+
end
69+
5370
puts
5471
end
5572

@@ -131,11 +148,29 @@ def write_pull_request_body!
131148
#{@updated_events.sort_by { |event| [event.date, event.name] }.map(&:to_md).join}
132149
MD
133150

151+
removed_meetups = @removed_events.any? ? <<~MD : ""
152+
#### Removed Meetups
153+
154+
| Title | Date |
155+
| ----- | ---- |
156+
#{@removed_events.sort_by { |event| [event.date, event.name] }.map(&:to_md).join}
157+
MD
158+
159+
cancelled_meetups = @cancelled_events.any? ? <<~MD : ""
160+
#### Cancelled Meetups
161+
162+
| Title | Date |
163+
| ----- | ---- |
164+
#{@cancelled_events.sort_by { |event| [event.date, event.name] }.map(&:to_md).join}
165+
MD
166+
134167
File.write("./pull_request_body.md", <<~MD)
135168
### Meetups Update from #{Date.today.strftime("%B %d, %Y")}
136169
137170
#{new_meetups}
138171
#{updated_meetups}
172+
#{removed_meetups}
173+
#{cancelled_meetups}
139174
MD
140175
end
141176

src/meetups_file_entry.rb

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
MeetupsFileEntry = Data.define(:name, :location, :date, :start_time, :end_time, :url) do
1+
MeetupsFileEntry = Data.define(:name, :location, :date, :start_time, :end_time, :url, :status) do
22
attr_reader :group
33

4-
def initialize(name:, location:, date:, start_time:, end_time:, url:, group: nil)
4+
def initialize(name:, location:, date:, start_time:, end_time:, url:, status: nil, group: nil)
55
date = date.is_a?(Date) ? date : Date.parse(date)
66
@group = group
7-
8-
super(name:, location:, date:, start_time:, end_time:, url:)
7+
super(name:, location:, date:, start_time:, end_time:, url:, status:)
98
end
109

1110
def self.from_yaml_item(hash)
@@ -16,7 +15,8 @@ def self.from_yaml_item(hash)
1615
start_time: hash["start_time"],
1716
end_time: hash["end_time"],
1817
url: hash["url"],
19-
group: hash["group"]
18+
group: hash["group"],
19+
status: hash["status"]
2020
)
2121
end
2222

@@ -25,14 +25,18 @@ def service_id
2525
end
2626

2727
def to_hash
28-
{
28+
hash = {
2929
"name" => name,
3030
"location" => location,
3131
"date" => date,
3232
"start_time" => start_time,
3333
"end_time" => end_time,
3434
"url" => url,
3535
}
36+
37+
hash["status"] = status if status.present?
38+
39+
hash
3640
end
3741

3842
def to_md

src/queries/events_query.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
country
1515
state
1616
city
17-
unifiedEvents(sortOrder: ASC) {
17+
upcomingEvents(input: { first: 50 }, filter: { includeCancelled: true }, sortOrder: ASC) {
1818
count
1919
edges {
2020
cursor

0 commit comments

Comments
 (0)