RC4Community
RC4Community copied to clipboard
[FIX] Limit Top Posts Count in Discourse Module
- [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)
- [ ] I have added necessary documentation (if applicable)
- [x] Any dependent changes have been merged and published in downstream modules
Proposed changes (including videos or screenshots)
- Made changes in the discourse module so that only the top N entries are stored in the CMS.
- Included checks to make sure that the same TopPost does not populate the database.
- On Every Call the excess old posts will be deleted and new fresh TopPost will be added.
Issue(s)
Fixes : #21
@RonLek @Sing-Li I have made the changes and have locally tested updating the data (with some dummy data) to maintain the top N posts only. Have also made sure that if the same post is fetched again, then it is not stored again in database. By default strapi will fetch posts in the order in which they are created. Hence, we delete the first X excess/stale posts and add our new TopPost to the CMS database after that. Let me know if there are any changes :smile: