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 account of the logged-in user who submitted the review, using their OAuth token (this
requires the gmail.send scope).
Sending is best effort: any failure is logged and never stops the 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 all moderators that a review needs moderation.
-
Field Details
-
GMAIL_SEND_URL
- See Also:
-
GMAIL_SEND_SCOPE
- 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 all moderators that a review needs moderation. Never throws.- Parameters:
review- the review that was just submitted
-