talawa-api
talawa-api copied to clipboard
[Feature Request] Posts and Events features and Spam mitigation for Talawa-admin issue fixed
What kind of change does this PR introduce?
feature
Issue Number:
Fixes #740
Did you add tests for your changes?
Yes
Snapshots/Videos:
-
Filter events
-
Filter posts
-
Update post
-
Spamming an organization group chat
-
Spammed user stores in organization
-
User document holding the data in which user has spammed
If relevant, did you update the documentation?
No
Summary
This Pull request is the changes in the backend regarding PalisadoesFoundation/talawa-admin#358
In this, the following things are implemented,
- A mutation is added to update the already existing post.
- A new function is implemented in the postsByOrganization resolver to filter the posts.
- A new function is implemented in the eventsByOrganization resolver to filter the events.
- A new field is added in the organization schema named ‘spamCount’ to store the details of users who spammed in the organization.
- A new field is added in the user schema named ‘spamInOrganizations’ to store the details of the organization in which the user has spammed.
- A new helper function is created named ‘checkSpamMessages’ to check whether the message is spam or not.
- To check whether the message is spam or not following tasks is done:
- Check whether the message contains the keywords of spam or not.
- Check the frequency of the last 30 messages. If the message frequency is less than 5 seconds then it is spam.
- A helper function is checking about the spam just before storing the messages in the database i.e. in the ‘sendMessageToGroupChat’ resolver.
- A new mutation is added named ‘updateSpamNotifcation’, to update the readed notifications in talawa-admin.
Does this PR introduce a breaking change?
No
Other information
This pull request is under GSoC'22.
Have you read the contributing guide?
Yes
Codecov Report
Merging #742 (74de117) into develop_legacy (cecf46f) will increase coverage by
2.52%
. The diff coverage is95.18%
.
@@ Coverage Diff @@
## develop_legacy #742 +/- ##
==================================================
+ Coverage 66.12% 68.65% +2.52%
==================================================
Files 190 195 +5
Lines 3398 3563 +165
Branches 724 774 +50
==================================================
+ Hits 2247 2446 +199
+ Misses 907 890 -17
+ Partials 244 227 -17
Impacted Files | Coverage Δ | |
---|---|---|
lib/models/Organization.js | 100.00% <ø> (ø) |
|
lib/models/User.js | 100.00% <ø> (ø) |
|
lib/resolvers/user_query/users.js | 23.40% <ø> (ø) |
|
lib/helper_functions/checkSpamMessage.js | 83.33% <83.33%> (ø) |
|
lib/resolvers/post_mutations/updatePost.js | 93.33% <93.33%> (ø) |
|
...s/organization_mutations/updateSpamNotification.js | 95.45% <95.45%> (ø) |
|
lib/resolvers/Mutation.js | 100.00% <100.00%> (ø) |
|
lib/resolvers/event_query/event_filter.js | 100.00% <100.00%> (ø) |
|
lib/resolvers/event_query/eventsByOrganization.js | 100.00% <100.00%> (ø) |
|
...ers/group_chat_mutations/sendMessageToGroupChat.js | 92.85% <100.00%> (+0.54%) |
:arrow_up: |
... and 5 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
@yasharth291 please review
This pull request did not get any activity in the past 60 days and will be closed in 365 days if no update occurs. Please verify it has no conflicts with the develop branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.
@yasharth291 Please review.
@yasharth291 Please review
@yasharth291 Please review so we can merge.
@asmitsirohi remove the conflicts
@asmitsirohi Please fix the failing tests
The code coverage has also declined with this PR. Please also add the corresponding tests needed to restore the coverage to the previous value or better.
@palisadoes @yasharth291, please see this now, I have resolved all the conflicts.