1
0
mirror of https://git.pleroma.social/sjw/pleroma-fe.git synced 2024-11-15 14:06:31 +01:00

Merge branch 'develop' into feature/2fa

This commit is contained in:
Maksim Pechnikov 2019-06-04 22:26:20 +03:00
commit e4a34d94a6
10 changed files with 81 additions and 9 deletions

View File

@ -2,7 +2,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<div class="title">
Interactions
{{ $t("nav.interactions") }}
</div>
</div>
<tab-switcher

View File

@ -29,7 +29,7 @@
</a>
</div>
<div class="mobile-notifications" @scroll="onScroll">
<Notifications ref="notifications" noHeading="true"/>
<Notifications ref="notifications" :noHeading="true"/>
</div>
</div>
<SideDrawer ref="sideDrawer" :logout="logout"/>

View File

@ -35,7 +35,6 @@ const Notifications = {
return unseenNotificationsFromStore(this.$store)
},
visibleNotifications () {
console.log(this.filterMode)
return visibleNotificationsFromStore(this.$store, this.filterMode)
},
unseenCount () {

View File

@ -56,7 +56,8 @@ const UserSettings = {
changePasswordInputs: [ '', '', '' ],
changedPassword: false,
changePasswordError: false,
activeTab: 'profile'
activeTab: 'profile',
notificationSettings: this.$store.state.users.currentUser.notification_settings
}
},
created () {
@ -130,6 +131,10 @@ const UserSettings = {
this.$store.commit('setCurrentUser', user)
})
},
updateNotificationSettings () {
this.$store.state.api.backendInteractor
.updateNotificationSettings({ settings: this.notificationSettings })
},
changeVis (visibility) {
this.newDefaultScope = visibility
},

View File

@ -167,6 +167,43 @@
</div>
</div>
<div :label="$t('settings.notifications')" v-if="pleromaBackend">
<div class="setting-item">
<div class="select-multiple">
<span class="label">{{$t('settings.notification_setting')}}</span>
<ul class="option-list">
<li>
<input type="checkbox" id="notification-setting-follows" v-model="notificationSettings.follows">
<label for="notification-setting-follows">
{{$t('settings.notification_setting_follows')}}
</label>
</li>
<li>
<input type="checkbox" id="notification-setting-followers" v-model="notificationSettings.followers">
<label for="notification-setting-followers">
{{$t('settings.notification_setting_followers')}}
</label>
</li>
<li>
<input type="checkbox" id="notification-setting-non-follows" v-model="notificationSettings.non_follows">
<label for="notification-setting-non-follows">
{{$t('settings.notification_setting_non_follows')}}
</label>
</li>
<li>
<input type="checkbox" id="notification-setting-non-followers" v-model="notificationSettings.non_followers">
<label for="notification-setting-non-followers">
{{$t('settings.notification_setting_non_followers')}}
</label>
</li>
</ul>
</div>
<p>{{$t('settings.notification_mutes')}}</p>
<p>{{$t('settings.notification_blocks')}}</p>
<button class="btn btn-default" @click="updateNotificationSettings">{{$t('general.submit')}}</button>
</div>
</div>
<div :label="$t('settings.data_import_export_tab')" v-if="pleromaBackend">
<div class="setting-item">
<h2>{{$t('settings.follow_import')}}</h2>

View File

@ -20,7 +20,8 @@ const WhoToFollow = {
id: 0,
name: i.display_name,
screen_name: i.acct,
profile_image_url: i.avatar || '/images/avi.png'
profile_image_url: i.avatar || '/images/avi.png',
profile_image_url_original: i.avatar || '/images/avi.png'
}
this.users.push(user)

View File

@ -317,6 +317,13 @@
"true": "yes"
},
"notifications": "Notifications",
"notification_setting": "Receive notifications from:",
"notification_setting_follows": "Users you follow",
"notification_setting_non_follows": "Users you do not follow",
"notification_setting_followers": "Users who follow you",
"notification_setting_non_followers": "Users who do not follow you",
"notification_mutes": "To stop receiving notifications from a specific user, use a mute.",
"notification_blocks": "Blocking a user stops all notifications as well as unsubscribes them.",
"enable_web_push_notifications": "Enable web push notifications",
"style": {
"switcher": {

View File

@ -16,6 +16,7 @@ const PERMISSION_GROUP_URL = (screenName, right) => `/api/pleroma/admin/users/${
const ACTIVATION_STATUS_URL = screenName => `/api/pleroma/admin/users/${screenName}/activation_status`
const ADMIN_USERS_URL = '/api/pleroma/admin/users'
const SUGGESTIONS_URL = '/api/v1/suggestions'
const NOTIFICATION_SETTINGS_URL = '/api/pleroma/notification_settings'
const MFA_SETTINGS_URL = '/api/pleroma/profile/mfa'
const MFA_BACKUP_CODES_URL = '/api/pleroma/profile/mfa/backup_codes'
@ -104,6 +105,21 @@ const promisedRequest = ({ method, url, payload, credentials, headers = {} }) =>
})
}
const updateNotificationSettings = ({credentials, settings}) => {
const form = new FormData()
each(settings, (value, key) => {
form.append(key, value)
})
return fetch(NOTIFICATION_SETTINGS_URL, {
headers: authHeaders(credentials),
method: 'PUT',
body: form
})
.then((data) => data.json())
}
const updateAvatar = ({credentials, avatar}) => {
const form = new FormData()
form.append('avatar', avatar)
@ -824,7 +840,8 @@ const apiService = {
markNotificationsAsSeen,
fetchFavoritedByUsers,
fetchRebloggedByUsers,
reportUser
reportUser,
updateNotificationSettings
}
export default apiService

View File

@ -87,6 +87,10 @@ const backendInteractorService = (credentials) => {
return apiService.deleteUser({screen_name, credentials})
}
const updateNotificationSettings = ({settings}) => {
return apiService.updateNotificationSettings({credentials, settings})
}
const fetchMutes = () => apiService.fetchMutes({credentials})
const muteUser = (id) => apiService.muteUser({credentials, id})
const unmuteUser = (id) => apiService.unmuteUser({credentials, id})
@ -182,7 +186,8 @@ const backendInteractorService = (credentials) => {
favorite,
unfavorite,
retweet,
unretweet
unretweet,
updateNotificationSettings
}
return backendInteractorServiceInstance

View File

@ -133,15 +133,16 @@ export const parseUser = (data) => {
if (data.pleroma) {
output.follow_request_count = data.pleroma.follow_request_count
}
if (data.pleroma) {
output.tags = data.pleroma.tags
output.deactivated = data.pleroma.deactivated
output.notification_settings = data.pleroma.notification_settings
}
output.tags = output.tags || []
output.rights = output.rights || {}
output.notification_settings = output.notification_settings || {}
return output
}