Browse Source

[Glitch] Fix frontend crash when deleting announcements

Port 8758221e73 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
closed-social-glitch-2
Daniel Sockwell 4 years ago
committed by Thibaut Girka
parent
commit
9da4bd098c
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      app/javascript/flavours/glitch/features/getting_started/components/announcements.js

+ 2
- 2
app/javascript/flavours/glitch/features/getting_started/components/announcements.js View File

@ -389,7 +389,7 @@ class Announcements extends ImmutablePureComponent {
_markAnnouncementAsRead () {
const { dismissAnnouncement, announcements } = this.props;
const { index } = this.state;
const announcement = announcements.get(index);
const announcement = announcements.get(index) || announcements.get(index - 1);
if (!announcement.get('read')) dismissAnnouncement(announcement.get('id'));
}
@ -407,7 +407,7 @@ class Announcements extends ImmutablePureComponent {
render () {
const { announcements, intl } = this.props;
const { index } = this.state;
const index = this.state.index < announcements.size ? this.state.index : announcements.size - 1;
if (announcements.isEmpty()) {
return null;

Loading…
Cancel
Save