Glitch-Shrike/app/javascript/mastodon/features
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
..
account/components Change the string "hidden" to "blocked" in WebUI (#13221) 2020-03-09 09:13:21 +01:00
account_gallery
account_timeline Add “account timeline” filter category (#12918) 2020-01-23 21:32:00 +01:00
audio Add tooltips to audio/video player buttons (#13203) 2020-03-05 15:52:15 +01:00
blocks Code style improvements in JavaScript (#13159) 2020-03-08 16:02:36 +01:00
bookmarked_statuses
community_timeline
compose Code style improvements in JavaScript (#13159) 2020-03-08 16:02:36 +01:00
direct_timeline
directory Fix unfollow confirmations in account directory (#12922) 2020-01-22 16:26:47 +01:00
domain_blocks Change the string "hidden" to "blocked" in WebUI (#13221) 2020-03-09 09:13:21 +01:00
emoji
favourited_statuses
favourites Code style improvements in JavaScript (#13159) 2020-03-08 16:02:36 +01:00
follow_requests Code style improvements in JavaScript (#13159) 2020-03-08 16:02:36 +01:00
followers Code style improvements in JavaScript (#13159) 2020-03-08 16:02:36 +01:00
following Code style improvements in JavaScript (#13159) 2020-03-08 16:02:36 +01:00
generic_not_found
getting_started Fix frontend crash when deleting announcements (#13283) 2020-03-21 03:10:42 +01:00
hashtag_timeline
home_timeline Change how unread announcements are handled (#13020) 2020-02-03 01:53:09 +01:00
introduction
keyboard_shortcuts
list_adder
list_editor
list_timeline
lists Code style improvements in JavaScript (#13159) 2020-03-08 16:02:36 +01:00
mutes Code style improvements in JavaScript (#13159) 2020-03-08 16:02:36 +01:00
notifications Add follow_request notification type (#12198) 2019-12-01 17:25:29 +01:00
pinned_statuses
public_timeline
reblogs Code style improvements in JavaScript (#13159) 2020-03-08 16:02:36 +01:00
report
search
standalone
status Fix detailed view of direct messages displaying a 0 boost count (#13244) 2020-03-10 18:39:47 +01:00
ui Code style improvements in JavaScript (#13159) 2020-03-08 16:02:36 +01:00
video Add tooltips to audio/video player buttons (#13203) 2020-03-05 15:52:15 +01:00