diff options
author | crupest <crupest@outlook.com> | 2021-05-15 19:22:13 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-05-15 19:22:13 +0800 |
commit | 8f88c6c995b340a64086aedd27d312d5732d3e7d (patch) | |
tree | e7448b5e5dbefe348abab8e0225f36082fb56f3c /BackEnd/Timeline/SignalRHub/TimelineHub.cs | |
parent | fbe66b184ae53712a66f68edbb9e7ee4227bd711 (diff) | |
download | timeline-8f88c6c995b340a64086aedd27d312d5732d3e7d.tar.gz timeline-8f88c6c995b340a64086aedd27d312d5732d3e7d.tar.bz2 timeline-8f88c6c995b340a64086aedd27d312d5732d3e7d.zip |
refactor: Move strings to resource.
Diffstat (limited to 'BackEnd/Timeline/SignalRHub/TimelineHub.cs')
-rw-r--r-- | BackEnd/Timeline/SignalRHub/TimelineHub.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/BackEnd/Timeline/SignalRHub/TimelineHub.cs b/BackEnd/Timeline/SignalRHub/TimelineHub.cs index 2ad7bd66..0bfda84c 100644 --- a/BackEnd/Timeline/SignalRHub/TimelineHub.cs +++ b/BackEnd/Timeline/SignalRHub/TimelineHub.cs @@ -32,19 +32,19 @@ namespace Timeline.SignalRHub var timelineId = await _timelineService.GetTimelineIdByNameAsync(timelineName);
var user = Context.User;
if (!user.HasPermission(UserPermission.AllTimelineManagement) && !await _timelineService.HasReadPermissionAsync(timelineId, user.GetOptionalUserId()))
- throw new HubException("Forbidden.");
+ throw new HubException(Resource.MessageForbidden);
var group = GenerateTimelinePostChangeListeningGroupName(timelineName);
await Groups.AddToGroupAsync(Context.ConnectionId, group);
- _logger.LogInformation("Add connection {0} to group {1}", Context.ConnectionId, group);
+ _logger.LogInformation(Resource.LogSubscribeTimelinePostChange, Context.ConnectionId, group);
}
catch (ArgumentException)
{
- throw new HubException("Timeline name is illegal.");
+ throw new HubException(Resource.MessageTimelineNameInvalid);
}
catch (EntityNotExistException)
{
- throw new HubException("Timeline not exist.");
+ throw new HubException(Resource.MessageTimelineNotExist);
}
}
@@ -52,7 +52,7 @@ namespace Timeline.SignalRHub {
var group = GenerateTimelinePostChangeListeningGroupName(timelineName);
await Groups.RemoveFromGroupAsync(Context.ConnectionId, group);
- _logger.LogInformation("Remove connection {0} from group {1}", Context.ConnectionId, group);
+ _logger.LogInformation(Resource.LogUnsubscribeTimelinePostChange, Context.ConnectionId, group);
}
}
}
|