aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/SignalRHub/TimelineHub.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-05-15 19:22:13 +0800
committercrupest <crupest@outlook.com>2021-05-15 19:22:13 +0800
commit8f88c6c995b340a64086aedd27d312d5732d3e7d (patch)
treee7448b5e5dbefe348abab8e0225f36082fb56f3c /BackEnd/Timeline/SignalRHub/TimelineHub.cs
parentfbe66b184ae53712a66f68edbb9e7ee4227bd711 (diff)
downloadtimeline-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.cs10
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);
}
}
}