Class ReportService
Users' reports of events, rooms and users: kept for the admin to review and resolve, and logged.
Inherited Members
Namespace: Uniform.Matrix.Server.Rooms
Assembly: Uniform.Matrix.Server.dll
Syntax
public sealed class ReportService
Constructors
| Edit this page View SourceReportService(IDbContextFactory<ServerDbContext>, TimeProvider, ILogger<ReportService>)
Create the service.
Declaration
public ReportService(IDbContextFactory<ServerDbContext> contexts, TimeProvider time, ILogger<ReportService> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| IDbContextFactory<ServerDbContext> | contexts | |
| TimeProvider | time | |
| ILogger<ReportService> | logger |
Fields
| Edit this page View SourceMaxReason
Longest reason kept.
Declaration
public const int MaxReason = 1000
Field Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceAddAsync(string, string?, string?, string?, string, CancellationToken)
Keep and log a report.
Declaration
public Task AddAsync(string reporter, string? roomId, string? eventId, string? userId, string reason, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| string | reporter | Who reports. |
| string | roomId | Reported room, or the room of the reported event. |
| string | eventId | Reported event, if any. |
| string | userId | Reported user, if any. |
| string | reason | Why; cut to MaxReason characters. |
| CancellationToken | cancellationToken | Cancellation token. |
Returns
| Type | Description |
|---|---|
| Task |
CountOpenAsync(CancellationToken)
Return the number of reports not resolved.
Declaration
public Task<int> CountOpenAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> |
DeleteAsync(long, CancellationToken)
Delete a report.
Declaration
public Task DeleteAsync(long id, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| long | id | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
GetAsync(bool, CancellationToken)
Return the reports, newest first; resolved ones only when asked.
Declaration
public Task<IReadOnlyList<Report>> GetAsync(bool includeResolved, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | includeResolved | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<IReadOnlyList<Report>> |
SetResolvedAsync(long, bool, CancellationToken)
Mark a report resolved, or open again.
Declaration
public Task SetResolvedAsync(long id, bool resolved, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| long | id | |
| bool | resolved | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |