Skip to content

[CORL 547] org-wide announcements#2813

Merged
kgardnr merged 20 commits intomasterfrom
feature/CORL-547
Feb 3, 2020
Merged

[CORL 547] org-wide announcements#2813
kgardnr merged 20 commits intomasterfrom
feature/CORL-547

Conversation

@tessalt
Copy link
Contributor

@tessalt tessalt commented Jan 29, 2020

What does this PR do?

  • adds config section to "General" pane allowing creation and deletion of announcements
  • displays announcements on stream for a specified duration
  • allows users to dismiss announcements

How do I test this PR?

  • navigate to configuration -> Community announcement
  • create an announcement
  • check that announcement is present above stream
  • dismiss announcement from stream
  • remove announcement from admin
  • create a new announcement
  • new announcement should display on stream

@tessalt tessalt requested a review from nick-funk January 29, 2020 19:20
@kgardnr kgardnr requested a review from alinhle January 29, 2020 19:23
@kgardnr kgardnr added this to the v5.5.0 milestone Jan 29, 2020
Copy link
Contributor

@alinhle alinhle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some concerns about the implementation of the announcement config as it conflicts with the top level form save button which makes it feel unintuitive and foreign. Let's discuss.

image

hour: "2-digit",
minute: "2-digit",
}).format(new Date(disableAt));
}, [disableAt]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like disableAt changing everytime which defeats the purpose of useMemo. I think line 26-28 should be inside the callback as well.

settings={settings}
createAnnouncement={createAnnouncement}
deleteAnnouncement={deleteAnnouncement}
/>
Copy link
Contributor

@alinhle alinhle Jan 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small suggestion would be to combine AnnouncementConfigContainer.tsx and AnnouncementConfig.tsx together into AnnouncementConfigContainer.tsx.

return [storedValue, setValue];
}

export default useLocalStorage;
Copy link
Contributor

@alinhle alinhle Jan 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have abstracted localStorage into CoralContext: src/core/client/framework/lib/bootstrap/CoralContext.tsx, so we should probably reuse that.

form: FormApi
) => {
await this.props.updateSettings({ settings: data });
const payload = omit(data, "announcement");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried about this, let's have a chat tomorrow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we had a chat about this in #coral-tech-talk a few days ago and couldn't come up with a good solution that didn't involve re-architecting the whole configuration section. Love to hear your suggestions on this!

useEffect(() => {
async function getDismissedStatus() {
if (!settings.announcement) {
setDismissed(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just ignore changing state when settings.announcement is not set right, because it's rendered as null anyway.

Copy link
Contributor

@alinhle alinhle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last comment: #2813 (comment).
Otherwise looks good, great work!

@alinhle
Copy link
Contributor

alinhle commented Jan 30, 2020

Maybe add tests if you feel like.

@kgardnr kgardnr merged commit a1a8652 into master Feb 3, 2020
@kgardnr kgardnr deleted the feature/CORL-547 branch February 3, 2020 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants