Merge branch 'develop' into twemoji

This commit is contained in:
Acid Chicken (硫酸鶏)
2018-11-05 11:21:34 +09:00
committed by GitHub
17 changed files with 69 additions and 76 deletions

View File

@ -10,7 +10,7 @@
<span>%i18n:@text%</span>
</ui-textarea>
<ui-horizon-group>
<ui-button @click="save">%fa:save R% %i18n:@save%</ui-button>
<ui-button @click="save()">%fa:save R% %i18n:@save%</ui-button>
<ui-button @click="remove(i)">%fa:trash-alt R% %i18n:@remove%</ui-button>
</ui-horizon-group>
</section>
@ -46,18 +46,31 @@ export default Vue.extend({
},
remove(i) {
this.announcements = this.announcements.filter((_, j) => j !== i);
this.save();
this.$swal({
type: 'warning',
text: '%i18n:@_remove.are-you-sure%'.replace('$1', this.announcements.find((_, j) => j == i).title),
showCancelButton: true
}).then(res => {
if (!res.value) return;
this.announcements = this.announcements.filter((_, j) => j !== i);
this.save(true);
this.$swal({
type: 'success',
text: '%i18n:@_remove.removed%'
});
});
},
save() {
save(silent) {
(this as any).api('admin/update-meta', {
broadcasts: this.announcements
}).then(() => {
this.$swal({
type: 'success',
text: '%i18n:@saved%'
});
if (!silent) {
this.$swal({
type: 'success',
text: '%i18n:@saved%'
});
}
}).catch(e => {
this.$swal({
type: 'error',

View File

@ -6,6 +6,7 @@
<ui-input v-model="name">%i18n:@instance-name%</ui-input>
<ui-textarea v-model="description">%i18n:@instance-description%</ui-textarea>
<ui-input v-model="bannerUrl">%i18n:@banner-url%</ui-input>
<ui-input v-model="maxNoteTextLength">%i18n:@max-note-text-length%</ui-input>
<ui-button @click="updateMeta">%i18n:@save%</ui-button>
</section>
</ui-card>
@ -39,6 +40,7 @@ export default Vue.extend({
bannerUrl: null,
name: null,
description: null,
maxNoteTextLength: null,
inviteCode: null,
};
},
@ -48,6 +50,7 @@ export default Vue.extend({
this.bannerUrl = meta.bannerUrl;
this.name = meta.name;
this.description = meta.description;
this.maxNoteTextLength = meta.maxNoteTextLength;
});
},
@ -69,7 +72,8 @@ export default Vue.extend({
disableLocalTimeline: this.disableLocalTimeline,
bannerUrl: this.bannerUrl,
name: this.name,
description: this.description
description: this.description,
maxNoteTextLength: parseInt(this.maxNoteTextLength, 10)
}).then(() => {
this.$swal({
type: 'success',