From f12d9d27fc38e14bd8afd5b1286f274a3ae091d2 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Mon, 23 Dec 2019 23:51:43 -0600 Subject: fix `queued:boosts` & `queued:posts` breaking if populated --- app/lib/bangtags.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb index 04c0f8c4e..a3874c128 100644 --- a/app/lib/bangtags.rb +++ b/app/lib/bangtags.rb @@ -897,7 +897,9 @@ class Bangtags when 'boosts', 'repeats' output = ["# Queued boosts\n"] @account.queued_boosts.find_each do |q| - output << "\\- [#{q.status_id}](#{TagManager.instance.url_for(q.status_id)})" + s = Status.find_by(id: q.status_id) + next if s.nil? + output << "\\- [#{q.status_id}](#{TagManager.instance.url_for(s)})" end if Redis.current.exists("queued_boost:#{@account.id}") output << "\nNext boost in #{Redis.current.ttl("queued_boost:#{@account.id}") / 60} minutes." @@ -909,11 +911,15 @@ class Bangtags when 'posts', 'statuses', 'roars' output = ["

Queued roars


"] @account.scheduled_statuses.find_each do |s| - preview = s.params['spoiler_text'] || s.params['text'] + s = Status.find_by(id: s.status_id) + next if s.nil? + + preview = s.spoiler_text || s.text preview = '[no body text]' if preview.blank? preview = preview[0..50] preview = html_entities.encode(preview) - output << "- #{preview}" + + output << "- #{preview}" end service_dm('announcements', @account, output.join("
"), content_type: 'text/html', footer: '#!queued:posts') end -- cgit