[CORL 547] org-wide announcements (#2813)

* CRUD announcements

* only show announcement if not disabled

* make announcements dismissable

* add announcement mutations

* update announcement form logic

* style announcements on stream

* update snap

* localize strings

* close form if announcement is removed

* move announcement config below sitewide commenting config

* move date calculation inside useMemo

* move announcementconfig code to announcementconfigcontainer

* use coralContext for localStorage

* fix type of announcement createdAt

* move announcement form to modal

* remove payload pruning from configure route

* simplify announcement display logic

* make validation message full width

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
This commit is contained in:
Tessa Thornton
2020-02-03 13:12:25 -05:00
committed by GitHub
co-authored by Kim Gardner
parent a7b2af85fc
commit a1a8652f7e
29 changed files with 855 additions and 1 deletions
@@ -1215,6 +1215,37 @@ type NewCommentersConfiguration {
approvedCommentsThreshold: Int!
}
"""
Announcement is an organization-wide announcement displayed above the stream
for a set duration
"""
type Announcement {
"""
id is a canonical identifier for this Annoucnement, used to dismiss on front-end.
"""
id: ID!
"""
createdAt is the creation date.
"""
createdAt: Time!
"""
disableAt is the computed date at which announcement will be invalid.
"""
disableAt: Time!
"""
duration determines how long the announcement will be valid for.
"""
duration: Int!
"""
content is the content displayed for the announcement.
"""
content: String!
}
"""
Settings stores the global settings for a given Tenant.
"""
@@ -1365,6 +1396,8 @@ type Settings {
newCommenters is the configuration for how new commenters comments are treated.
"""
newCommenters: NewCommentersConfiguration! @auth(roles: [ADMIN])
announcement: Announcement
}
################################################################################
@@ -3353,6 +3386,44 @@ input RecentCommentHistoryConfigurationInput {
triggerRejectionRate: Float
}
input CreateAnnouncementInput {
"""
content of the announcement.
"""
content: String!
duration: Int!
"""
clientMutationId is required for Relay support.
"""
clientMutationId: String!
}
input DeleteAnnouncementInput {
"""
clientMutationId is required for Relay support.
"""
clientMutationId: String!
}
type CreateAnnouncementPayload {
"""
clientMutationId is required for Relay support.
"""
clientMutationId: String!
settings: Settings!
}
type DeleteAnnouncementPayload {
"""
clientMutationId is required for Relay support.
"""
clientMutationId: String!
settings: Settings!
}
input SettingsCommunityGuidelinesInput {
"""
enable set to true will show the guidelines above the message box.
@@ -5763,6 +5834,14 @@ type Mutation {
disableFeatureFlag(
input: DisableFeatureFlagInput!
): DisableFeatureFlagPayload! @auth(roles: [ADMIN])
createAnnouncement(
input: CreateAnnouncementInput!
): CreateAnnouncementPayload! @auth(roles: [ADMIN])
deleteAnnouncement(
input: DeleteAnnouncementInput!
): DeleteAnnouncementPayload! @auth(roles: [ADMIN])
}
##################