about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Sockwell <dsockwell@gmail.com>2020-03-20 22:10:42 -0400
committerGitHub <noreply@github.com>2020-03-21 03:10:42 +0100
commit8758221e7344645bc1357578ec1789aa7d46da08 (patch)
tree13842c65ead6862d2ae86296b6511d29f46544c8 /lib
parentb5dace62b0b65f8b24a9266f96f945d65bda30c9 (diff)
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.
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions