tootlab-mastodon/app/javascript
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
..
fonts Redesign the landing page, mount public timeline on it (#4122) 2017-07-11 15:27:59 +02:00
images Add announcements (#12662) 2020-01-23 22:00:13 +01:00
mastodon Fix frontend crash when deleting announcements (#13283) 2020-03-21 03:10:42 +01:00
packs Fix dates (without time) being rendered as datetimes in public pages (#13034) 2020-02-03 17:48:56 +01:00
styles Fix text area above/right of emoji picker being accidentally clickable in web UI (#13148) 2020-03-08 15:36:50 +01:00