Skip to content

Commit

Permalink
show channel loading error in the UI
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Nov 9, 2022
1 parent 73bf4e3 commit ea16536
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Controller/MattermostAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function getNotifications(?int $since = null) {
public function getChannels() {
$result = $this->mattermostAPIService->getMyChannels($this->userId, $this->mattermostUrl);
if (isset($result['error'])) {
return new DataResponse($result['error'], Http::STATUS_BAD_REQUEST);
return new DataResponse($result, Http::STATUS_BAD_REQUEST);
} else {
return new DataResponse($result);
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/SendFilesModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ import EyeIcon from 'vue-material-design-icons/Eye.vue'
import RadioElementSet from './RadioElementSet.vue'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
import MattermostIcon from './icons/MattermostIcon.vue'
import { humanFileSize } from '../utils.js'
Expand Down Expand Up @@ -377,6 +378,10 @@ export default {
this.selectedChannel = this.sortedChannels[0]
}
}).catch((error) => {
showError(
t('integration_mattermost', 'Failed to load Mattermost channels')
+ ': ' + error.response?.data?.error
)
console.error(error)
})
},
Expand Down

0 comments on commit ea16536

Please sign in to comment.