Class ModeratorNotificationService
java.lang.Object
edu.ucsb.cs156.dining.services.ModeratorNotificationService
Emails all moderators when a review needs moderation.
The email is sent through the Gmail API from the Google account of the logged-in user who submitted the review, using the OAuth access token they got when they logged in. This requires the gmail.send scope (see docs/oauth.md).
Sending is best effort: every failure is logged, and notifyModerators(Review) never
throws, so a problem with email can never stop a review from being saved.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionModeratorNotificationService(org.springframework.security.oauth2.client.OAuth2AuthorizedClientService authorizedClientService, ModeratorRepository moderatorRepository, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder) -
Method Summary
Modifier and TypeMethodDescriptionvoidnotifyModerators(Review review) Emails every moderator that the given review is waiting for moderation.
-
Field Details
-
GMAIL_SEND_URL
- See Also:
-
GMAIL_SEND_SCOPE
- See Also:
-
SUBJECT
- See Also:
-
-
Constructor Details
-
ModeratorNotificationService
public ModeratorNotificationService(org.springframework.security.oauth2.client.OAuth2AuthorizedClientService authorizedClientService, ModeratorRepository moderatorRepository, org.springframework.boot.web.client.RestTemplateBuilder restTemplateBuilder)
-
-
Method Details
-
notifyModerators
Emails every moderator that the given review is waiting for moderation. Never throws.- Parameters:
review- the review that needs moderation
-