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
commit2a3c2d60cadbae348632ad9f2023367c5ea1e905 (patch)
treeb4f24fcf60bbbdffa23c399a23f897484f9126d5 /BackEnd/Timeline/SignalRHub/TimelineHub.cs
parente64abed06d37ac5ccbe2728b022489b7c2a9ceab (diff)
downloadtimeline-2a3c2d60cadbae348632ad9f2023367c5ea1e905.tar.gz
timeline-2a3c2d60cadbae348632ad9f2023367c5ea1e905.tar.bz2
timeline-2a3c2d60cadbae348632ad9f2023367c5ea1e905.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);
}
}
}