report.go (2333B)
1 // GoToSocial 2 // Copyright (C) GoToSocial Authors admin@gotosocial.org 3 // SPDX-License-Identifier: AGPL-3.0-or-later 4 // 5 // This program is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU Affero General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Affero General Public License for more details. 14 // 15 // You should have received a copy of the GNU Affero General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 package email 19 20 const ( 21 newReportTemplate = "email_new_report.tmpl" 22 newReportSubject = "GoToSocial New Report" 23 reportClosedTemplate = "email_report_closed.tmpl" 24 reportClosedSubject = "GoToSocial Report Closed" 25 ) 26 27 type NewReportData struct { 28 // URL of the instance to present to the receiver. 29 InstanceURL string 30 // Name of the instance to present to the receiver. 31 InstanceName string 32 // URL to open the report in the settings panel. 33 ReportURL string 34 // Domain from which the report originated. 35 // Can be empty string for local reports. 36 ReportDomain string 37 // Domain targeted by the report. 38 // Can be empty string for local reports targeting local users. 39 ReportTargetDomain string 40 } 41 42 func (s *sender) SendNewReportEmail(toAddresses []string, data NewReportData) error { 43 return s.sendTemplate(newReportTemplate, newReportSubject, data, toAddresses...) 44 } 45 46 type ReportClosedData struct { 47 // Username to be addressed. 48 Username string 49 // URL of the instance to present to the receiver. 50 InstanceURL string 51 // Name of the instance to present to the receiver. 52 InstanceName string 53 // Username of the report target. 54 ReportTargetUsername string 55 // Domain of the report target. 56 // Can be empty string for local reports targeting local users. 57 ReportTargetDomain string 58 // Comment left by the admin who closed the report. 59 ActionTakenComment string 60 } 61 62 func (s *sender) SendReportClosedEmail(toAddress string, data ReportClosedData) error { 63 return s.sendTemplate(reportClosedTemplate, reportClosedSubject, data, toAddress) 64 }