RC4Community
RC4Community copied to clipboard
[NEW] Announcement component
- [x] I have read the Contributing Guide - https://github.com/RocketChat/Rocket.Chat/blob/develop/.github/CONTRIBUTING.md#contributing-to-rocketchat doc
- [x] I have signed the CLA - https://cla-assistant.io/RocketChat/Rocket.Chat
- [x] Lint and unit tests pass locally with my changes
- [ ] I have added tests that prove my fix is effective or that my feature works (if applicable)
- [x] I have added necessary documentation (if applicable)
- [x] Any dependent changes have been merged and published in downstream modules
Issues
Mentioned in the issue #113
Proposed changes (including videos or screenshots)
- Add New Announcement Component which can display relevant announcement on any page using a helper function -
getAnnouncementData('announcement_code'). - The component has been added to the layout and is only displayed when a relevant/published
announcementis fetched usinggetAnnouncementData('announcement_code')code function and passed in the page props. - Added
announcementcollection type / schema to store announcements in the database. - Announcements have a publish_date and unpublish_date
- Announcements are only displayed after the publish_date and before the unpublish_date
- Added a
deleteOldAnnouncemts()helper function as a cron job which will run once a day and will delete any announcements which are supposed to be unpublished depending on the date. This will ensure that unwanted announcements do not clutter the database. - At the time of data-initialization , the announcements in
cms/config/initialData/announcemnets.jsonwill populate the data base.
https://user-images.githubusercontent.com/70485812/160889912-0181fd56-e62d-416c-9c6d-0a92280bbc94.mp4
- Added Documentation for the usage of the component.
@debdutdeb I have rebased the branch with the master branch and there are no more build errors. Build is not failing anymore 😅