diff --git a/CHANGELOG.md b/CHANGELOG.md index 770681f7..dde5f9f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Actions in users module (ActivateUsers, AddRight, DeactivateUsers, DeleteRight, DeleteUsers) now accept an array of users instead of one user - Leave dropdown menu open after clicking an action - Move current try/catch error handling from view files to module, add it where necessary +- Display checkboxes in status card and fetch statuses only when status card was rendered from Statuses by instance page +- Move statuses by instance state from local state to store state +- Pass user's ID to actions that moderate users when action is called from user's profile page ### Added @@ -32,6 +35,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Show checkmarks when tag is applied - Reports update (also, now it's optimistic) - Remove duplicated success message +- Fix styles for Statuses by instance page ## [1.2.0] - 2019-09-27 diff --git a/src/api/status.js b/src/api/status.js index ab9334e5..676cd9dc 100644 --- a/src/api/status.js +++ b/src/api/status.js @@ -21,7 +21,7 @@ export async function deleteStatus(id, authHost, token) { }) } -export async function fetchStatusesByInstance(instance, authHost, token, pageSize, page = 1) { +export async function fetchStatusesByInstance({ instance, authHost, token, pageSize, page }) { return await request({ baseURL: baseName(authHost), url: `/api/pleroma/admin/instances/${instance}/statuses?page=${page}&page_size=${pageSize}`, diff --git a/src/components/Status/index.vue b/src/components/Status/index.vue index 5ff766b4..99d4df0f 100644 --- a/src/components/Status/index.vue +++ b/src/components/Status/index.vue @@ -5,10 +5,9 @@
- +
{{ $t('statuses.loadMore') }} @@ -42,43 +48,50 @@ export default { }, data() { return { - selectedInstance: '', - selectedUsers: [], - page: 1, - pageSize: 30 + selectedUsers: [] } }, computed: { - loadingPeers() { - return this.$store.state.peers.loading - }, ...mapGetters([ 'instances', 'statuses' - ]) - }, - created() { + ]), + isDesktop() { + return this.$store.state.app.device === 'desktop' + }, + loadingPeers() { + return this.$store.state.peers.loading + }, + page() { + return this.$store.state.status.statusesByInstance.page + }, + pageSize() { + return this.$store.state.status.statusesByInstance.pageSize + }, + selectedInstance: { + get() { + return this.$store.state.status.statusesByInstance.selectedInstance + }, + set(instance) { + this.$store.dispatch('HandleFilterChange', instance) + } + } }, mounted() { this.$store.dispatch('FetchPeers') }, methods: { - handleFilterChange(instance) { - this.page = 1 - - this.$store.dispatch('FetchStatusesByInstance', { instance, page: this.page, pageSize: this.pageSize }) + handleFilterChange() { + this.$store.dispatch('HandlePageChange', 1) + this.$store.dispatch('FetchStatusesByInstance') }, handleLoadMore() { - this.page = this.page + 1 + this.$store.dispatch('HandlePageChange', this.page + 1) - this.$store.dispatch('FetchStatusesPageByInstance', { - instance: this.selectedInstance, - page: this.page, - pageSize: this.pageSize - }) + this.$store.dispatch('FetchStatusesPageByInstance') }, clearSelection() { - // TODO + this.selectedUsers = [] }, handleStatusSelection(user) { if (this.selectedUsers.find(selectedUser => user.id === selectedUser.id) !== undefined) { @@ -99,7 +112,14 @@ export default { } } .filter-container { - margin: 22px 15px 15px 0; + display: flex; + height: 36px; + justify-content: space-between; + align-items: center; + margin: 22px 0 15px 0; +} +.select-instance { + width: 350px; } .statuses-pagination { padding: 15px 0; @@ -108,4 +128,20 @@ export default { h1 { margin: 22px 0 0 0; } + +@media +only screen and (max-width: 760px), +(min-device-width: 768px) and (max-device-width: 1024px) { + .filter-container { + display: flex; + height: 36px; + flex-direction: column; + margin: 10px 10px + } + + .select-field { + width: 100%; + margin-bottom: 5px; + } +} diff --git a/src/views/users/components/ModerationDropdown.vue b/src/views/users/components/ModerationDropdown.vue index d6e361ad..e4a974c1 100644 --- a/src/views/users/components/ModerationDropdown.vue +++ b/src/views/users/components/ModerationDropdown.vue @@ -131,10 +131,10 @@ export default { this.$store.dispatch('ResendConfirmationEmail', [user]) }, handleDeletion(user) { - this.$store.dispatch('DeleteUsers', [user]) + this.$store.dispatch('DeleteUsers', { users: [user], _userId: user.id }) }, handleEmailConfirmation(user) { - this.$store.dispatch('ConfirmUsersEmail', [user]) + this.$store.dispatch('ConfirmUsersEmail', { users: [user], _userId: user.id }) }, requirePasswordReset(user) { const mailerEnabled = this.$store.state.user.nodeInfo.metadata.mailerEnabled @@ -152,18 +152,18 @@ export default { }, toggleActivation(user) { user.deactivated - ? this.$store.dispatch('ActivateUsers', [user]) - : this.$store.dispatch('DeactivateUsers', [user]) + ? this.$store.dispatch('ActivateUsers', { users: [user], _userId: user.id }) + : this.$store.dispatch('DeactivateUsers', { users: [user], _userId: user.id }) }, toggleTag(user, tag) { user.tags.includes(tag) - ? this.$store.dispatch('RemoveTag', { users: [user], tag }) - : this.$store.dispatch('AddTag', { users: [user], tag }) + ? this.$store.dispatch('RemoveTag', { users: [user], tag, _userId: user.id }) + : this.$store.dispatch('AddTag', { users: [user], tag, _userId: user.id }) }, toggleUserRight(user, right) { user.roles[right] - ? this.$store.dispatch('DeleteRight', { users: [user], right }) - : this.$store.dispatch('AddRight', { users: [user], right }) + ? this.$store.dispatch('DeleteRight', { users: [user], right, _userId: user.id }) + : this.$store.dispatch('AddRight', { users: [user], right, _userId: user.id }) } } } diff --git a/src/views/users/components/MultipleUsersMenu.vue b/src/views/users/components/MultipleUsersMenu.vue index de058ad8..eaf6d742 100644 --- a/src/views/users/components/MultipleUsersMenu.vue +++ b/src/views/users/components/MultipleUsersMenu.vue @@ -180,19 +180,19 @@ export default { }, activate: () => { const filtered = this.selectedUsers.filter(user => user.deactivated && this.$store.state.user.id !== user.id) - const activateUsersFn = async(users) => await this.$store.dispatch('ActivateUsers', users) + const activateUsersFn = async(users) => await this.$store.dispatch('ActivateUsers', { users }) applyAction(filtered, activateUsersFn) }, deactivate: () => { const filtered = this.selectedUsers.filter(user => !user.deactivated && this.$store.state.user.id !== user.id) - const deactivateUsersFn = async(users) => await this.$store.dispatch('DeactivateUsers', users) + const deactivateUsersFn = async(users) => await this.$store.dispatch('DeactivateUsers', { users }) applyAction(filtered, deactivateUsersFn) }, remove: () => { const filtered = this.selectedUsers.filter(user => this.$store.state.user.id !== user.id) - const deleteAccountFn = async(users) => await this.$store.dispatch('DeleteUsers', users) + const deleteAccountFn = async(users) => await this.$store.dispatch('DeleteUsers', { users }) applyAction(filtered, deleteAccountFn) }, @@ -202,7 +202,6 @@ export default { ? user.local && !user.tags.includes(tag) : !user.tags.includes(tag)) const addTagFn = async(users) => await this.$store.dispatch('AddTag', { users, tag }) - applyAction(filtered, addTagFn) }, removeTag: (tag) => async() => { @@ -222,7 +221,7 @@ export default { }, confirmAccounts: () => { const filtered = this.selectedUsers.filter(user => user.local && user.confirmation_pending) - const confirmAccountFn = async(users) => await this.$store.dispatch('ConfirmUsersEmail', users) + const confirmAccountFn = async(users) => await this.$store.dispatch('ConfirmUsersEmail', { users }) applyAction(filtered, confirmAccountFn) }, diff --git a/src/views/users/show.vue b/src/views/users/show.vue index aa826c07..40952aeb 100644 --- a/src/views/users/show.vue +++ b/src/views/users/show.vue @@ -92,7 +92,7 @@ - +

{{ $t('userProfile.noStatuses') }}