hometown/app
Daniel Sockwell 8758221e73
Fix frontend crash when deleting announcements (#13283)
This two-line change fixes a crash in the front end that occurred
under the following circumstances:
 *  A server had more than one announcement,
 *  A user was displaying the announcements, and
 *  An announcement was deleted (or unpublished, which amounts to
    the same thing.)

As might be expected, the bug was caused by attempting to access a
notification using an index value outside the bounds of the existing
announcements.  Specifically, in two places.  First,
`_markAnnouncementAsRead` attempts to modify announcements based on
the current index.  This is what caused the front end crash.  Second,
when rendering the `Announcements` component, the code paginates the
announcements and displays the current one.  This did not cause a
crash, but caused the front end to confusingly display a blank
announcement (in situations that would have caused a crash) with no
way for the user to navigate back to previous announcements.

This commit fixes both issues by adding a check to ensure that the
code never attempts to access an announcement with an index greater
than or equal to the number of announcements present.
2020-03-21 03:10:42 +01:00
..
chewy Fix needlessly indexing unsearchable statuses into ElasticSearch (#12041) 2019-10-02 20:04:46 +02:00
controllers Add option to include resolved DNS records when blacklisting e-mail domains in admin UI (#13254) 2020-03-12 22:35:20 +01:00
helpers Add ability to delete files uploaded for settings in admin UI (#13192) 2020-03-08 16:00:24 +01:00
javascript Fix frontend crash when deleting announcements (#13283) 2020-03-21 03:10:42 +01:00
lib Bump cld3 from 3.2.6 to 3.3.0 (#13107) 2020-03-09 00:12:52 +01:00
mailers Fix error when sending moderation notification (#13014) 2020-02-01 15:42:12 +01:00
models Fix reported accounts not being whitelisted when resolving a spamcheck report (#13289) 2020-03-21 03:08:09 +01:00
policies Add ability to delete files uploaded for settings in admin UI (#13192) 2020-03-08 16:00:24 +01:00
presenters Fix n+1 query for bookmarks on statuses (#12494) 2019-11-28 04:08:00 +01:00
serializers Change local media attachments to perform heavy processing asynchronously (#13210) 2020-03-08 23:56:18 +01:00
services Fix some timeouts when searching URLs by limiting some database queries (#13253) 2020-03-12 23:06:43 +01:00
validators Search account domain in lowercase (#13016) 2020-02-01 15:42:24 +01:00
views Add option to include resolved DNS records when blacklisting e-mail domains in admin UI (#13254) 2020-03-12 22:35:20 +01:00
workers Change local media attachments to perform heavy processing asynchronously (#13210) 2020-03-08 23:56:18 +01:00