chore: Use globalConfig in NetworkNotification (#3871)

This commit is contained in:
Pranav Raj S 2022-01-31 22:55:51 -08:00 committed by GitHub
parent b1e1d7e423
commit e0d24e0a73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 12 deletions

View file

@ -4,7 +4,12 @@
<div class="ui-notification">
<fluent-icon icon="wifi-off" />
<p class="ui-notification-text">
{{ $t('NETWORK.NOTIFICATION.TEXT') }}
{{
useInstallationName(
$t('NETWORK.NOTIFICATION.TEXT'),
globalConfig.installationName
)
}}
</p>
<woot-button variant="clear" size="small" @click="refreshPage">
{{ $t('NETWORK.BUTTON.REFRESH') }}
@ -23,13 +28,22 @@
</template>
<script>
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { mapGetters } from 'vuex';
export default {
mixins: [globalConfigMixin],
data() {
return {
showNotification: !navigator.onLine,
};
},
computed: {
...mapGetters({ globalConfig: 'globalConfig/get' }),
},
mounted() {
window.addEventListener('offline', this.updateOnlineStatus);
},

View file

@ -19,7 +19,10 @@
:multiple="enableMultipleFileUpload"
:drop="true"
:drop-directory="false"
:data="{ direct_upload_url: '/rails/active_storage/direct_uploads', direct_upload: true }"
:data="{
direct_upload_url: '/rails/active_storage/direct_uploads',
direct_upload: true,
}"
@input-file="onDirectFileUpload"
>
<woot-button
@ -81,7 +84,7 @@
<script>
import FileUpload from 'vue-upload-component';
import * as ActiveStorage from "activestorage";
import * as ActiveStorage from 'activestorage';
import {
hasPressedAltAndWKey,
hasPressedAltAndAKey,
@ -152,9 +155,6 @@ export default {
default: true,
},
},
mounted() {
ActiveStorage.start();
},
computed: {
isNote() {
return this.mode === REPLY_EDITOR_MODES.NOTE;
@ -176,6 +176,9 @@ export default {
return ALLOWED_FILE_TYPES;
},
},
mounted() {
ActiveStorage.start();
},
methods: {
handleKeyEvents(e) {
if (hasPressedAltAndWKey(e)) {

View file

@ -456,12 +456,15 @@ export default {
return;
}
if (checkFileSizeLimit(file, MAXIMUM_FILE_UPLOAD_SIZE)) {
const upload = new DirectUpload(file.file, '/rails/active_storage/direct_uploads', null, file.file.name);
const upload = new DirectUpload(
file.file,
'/rails/active_storage/direct_uploads',
null,
file.file.name
);
upload.create((error, blob) => {
if (error) {
this.showAlert(
error
);
this.showAlert(error);
} else {
this.attachedFiles.push({
currentChatId: this.currentChat.id,

View file

@ -54,7 +54,12 @@ export default {
this.isUploading = true;
try {
if (checkFileSizeLimit(file, MAXIMUM_FILE_UPLOAD_SIZE)) {
const upload = new DirectUpload(file.file, '/rails/active_storage/direct_uploads', null, file.file.name);
const upload = new DirectUpload(
file.file,
'/rails/active_storage/direct_uploads',
null,
file.file.name
);
upload.create((error, blob) => {
if (error) {
@ -64,7 +69,7 @@ export default {
} else {
this.onAttach({
fileType: blob.content_type,
file: blob.signed_id
file: blob.signed_id,
});
}
});