From a2ba96ab820c5b3e8d3050e77952d48eee2be776 Mon Sep 17 00:00:00 2001 From: gion Date: Wed, 22 Apr 2020 22:48:26 +0200 Subject: [PATCH] Handle error messages --- src/components/syncplay/groupSelectionMenu.js | 4 ++-- src/components/syncplay/syncplayManager.js | 20 ++++++++++++++++++- src/strings/en-us.json | 7 +++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/components/syncplay/groupSelectionMenu.js b/src/components/syncplay/groupSelectionMenu.js index c907d338a4..be54d92214 100644 --- a/src/components/syncplay/groupSelectionMenu.js +++ b/src/components/syncplay/groupSelectionMenu.js @@ -57,7 +57,7 @@ function showNewJoinGroupSelection (button, user, apiClient) { icon: "group", id: group.GroupId, selected: false, - secondaryText: group.Partecipants.join(", ") + secondaryText: group.Participants.join(", ") }; }); @@ -74,7 +74,7 @@ function showNewJoinGroupSelection (button, user, apiClient) { if (menuItems.length === 0) { if (inSession && policy.SyncplayAccess === "JoinGroups") { toast({ - text: globalize.translate('MessageSyncplayPermissionRequired') + text: globalize.translate('MessageSyncplayCreateGroupDenied') }); } else { toast({ diff --git a/src/components/syncplay/syncplayManager.js b/src/components/syncplay/syncplayManager.js index 0ca7c13149..0de232108b 100644 --- a/src/components/syncplay/syncplayManager.js +++ b/src/components/syncplay/syncplayManager.js @@ -274,7 +274,25 @@ class SyncplayManager { text: globalize.translate('MessageSyncplayGroupWait', cmd.Data) }); break; - case 'KeepAlive': + case 'GroupNotJoined': + toast({ + text: globalize.translate('MessageSyncplayGroupNotJoined', cmd.Data) + }); + break; + case 'CreateGroupDenied': + toast({ + text: globalize.translate('MessageSyncplayCreateGroupDenied', cmd.Data) + }); + break; + case 'JoinGroupDenied': + toast({ + text: globalize.translate('MessageSyncplayJoinGroupDenied', cmd.Data) + }); + break; + case 'LibraryAccessDenied': + toast({ + text: globalize.translate('MessageSyncplayLibraryAccessDenied', cmd.Data) + }); break; default: console.error('processSyncplayGroupUpdate does not recognize: ' + cmd.Type); diff --git a/src/strings/en-us.json b/src/strings/en-us.json index 43b5f14148..fb72e8881c 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -1034,9 +1034,12 @@ "MessageSyncplayUserJoined": "{0} joined group.", "MessageSyncplayUserLeft": "{0} left group.", "MessageSyncplayGroupWait": "{0} is buffering...", - "MessageSyncplayNoGroupsAvailable": "No groups available.", - "MessageSyncplayPermissionRequired": "Permission required to create a group.", + "MessageSyncplayNoGroupsAvailable": "No groups available. Start playing something first.", "MessageSyncplayPlaybackPermissionRequired": "Playback permission required.", + "MessageSyncplayGroupNotJoined": "Failed to join requested group.", + "MessageSyncplayCreateGroupDenied": "Permission required to create a group.", + "MessageSyncplayJoinGroupDenied": "Permission required to use Syncplay.", + "MessageSyncplayLibraryAccessDenied": "Access to this content is restricted.", "Metadata": "Metadata", "MetadataManager": "Metadata Manager", "MetadataSettingChangeHelp": "Changing metadata settings will affect new content that is added going forward. To refresh existing content, open the detail screen and click the refresh button, or perform bulk refreshes using the metadata manager.",