mirror of
https://git.notfire.cc/notfire/akkoma-fe.git
synced 2026-01-10 21:13:19 -08:00
add bite back support, cleanup
This commit is contained in:
parent
4f402d43a4
commit
bbe87c4743
7 changed files with 44 additions and 5 deletions
|
|
@ -50,9 +50,7 @@
|
|||
- download by entering `tools/` and running `python3 download_ruffle.py`
|
||||
|
||||
### also of note for anyone running this fork
|
||||
- aside from the stuff mentioned above, the following features will require patches to work:
|
||||
- mfm ([patch](https://git.notfire.cc/notfire/iceshrimp-patches/src/branch/main/0004-mfm-in-mastoapi.patch))
|
||||
- previewing posts ([patch](https://git.notfire.cc/notfire/iceshrimp-patches/src/branch/main/0005-previews-in-mastoapi.patch))
|
||||
n/a
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -136,6 +136,10 @@ const Notification = {
|
|||
})
|
||||
|
||||
return isFiltered
|
||||
},
|
||||
biteBack () {
|
||||
let id = this.notification.bite_back_id
|
||||
return this.$store.state.api.backendInteractor.biteBack({ id })
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
{{ ' ' }}
|
||||
<small>{{ $t('notifications.follow_request') }}</small>
|
||||
</span>
|
||||
<span v-if="notification.type === 'bite'">
|
||||
<span v-if="notification.type === 'bite' && notification.bite_back === false">
|
||||
<FAIcon
|
||||
class="type-icon"
|
||||
icon="tooth"
|
||||
|
|
@ -127,6 +127,14 @@
|
|||
{{ ' ' }}
|
||||
<small>{{ $t('notifications.bit_note') }}</small>
|
||||
</span>
|
||||
<span v-if="notification.type === 'bite' && notification.bite_back === true">
|
||||
<FAIcon
|
||||
class="type-icon"
|
||||
icon="tooth"
|
||||
/>
|
||||
{{ ' ' }}
|
||||
<small>{{ $t('notifications.bit_back') }}</small>
|
||||
</span>
|
||||
<span v-if="notification.type === 'update'">
|
||||
<FAIcon
|
||||
class="type-icon"
|
||||
|
|
@ -260,6 +268,16 @@
|
|||
|
||||
class="move-text"
|
||||
>
|
||||
<button
|
||||
class="btn button-default"
|
||||
@click="biteBack"
|
||||
>
|
||||
{{ $t('notifications.bite_back') }}
|
||||
<FAIcon
|
||||
class="type-icon"
|
||||
icon="tooth"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
<template v-else>
|
||||
<StatusContent
|
||||
|
|
|
|||
|
|
@ -328,7 +328,9 @@
|
|||
},
|
||||
"notifications": {
|
||||
"bit": "bit you!",
|
||||
"bit_back": "bit back!",
|
||||
"bit_note": "bit your note!",
|
||||
"bite_back": "Bite back",
|
||||
"broken_favorite": "Unknown post, searching for it…",
|
||||
"edited": "edited a post",
|
||||
"error": "Error fetching notifications: {0}",
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ const MASTODON_BLOCK_USER_URL = id => `/api/v1/accounts/${id}/block`
|
|||
const MASTODON_UNBLOCK_USER_URL = id => `/api/v1/accounts/${id}/unblock`
|
||||
const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute`
|
||||
const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute`
|
||||
const MASTODON_BITE_BACK_URL = id => `/api/v1/bites/${id}/bite_back`
|
||||
const MASTODON_BITE_USER_URL = id => `/api/v1/users/${id}/bite`
|
||||
const MASTODON_BITE_NOTE_URL = id => `/api/v1/statuses/${id}/bite`
|
||||
const MASTODON_REMOVE_USER_FROM_FOLLOWERS = id => `/api/v1/accounts/${id}/remove_from_followers`
|
||||
|
|
@ -316,6 +317,13 @@ const unblockUser = ({ id, credentials }) => {
|
|||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const biteBack = ({ id, credentials }) => {
|
||||
return fetch(MASTODON_BITE_BACK_URL(id), {
|
||||
headers: authHeaders(credentials),
|
||||
method: 'POST'
|
||||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const biteUser = ({ id, credentials }) => {
|
||||
return fetch(MASTODON_BITE_USER_URL(id), {
|
||||
headers: authHeaders(credentials),
|
||||
|
|
@ -330,7 +338,6 @@ const biteNote = ({ id, credentials }) => {
|
|||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
|
||||
const removeUserFromFollowers = ({ id, credentials }) => {
|
||||
return fetch(MASTODON_REMOVE_USER_FROM_FOLLOWERS(id), {
|
||||
headers: authHeaders(credentials),
|
||||
|
|
@ -1786,6 +1793,7 @@ const apiService = {
|
|||
unmuteConversation,
|
||||
blockUser,
|
||||
unblockUser,
|
||||
biteBack,
|
||||
biteUser,
|
||||
biteNote,
|
||||
removeUserFromFollowers,
|
||||
|
|
|
|||
|
|
@ -426,11 +426,16 @@ export const parseNotification = (data) => {
|
|||
}
|
||||
if (output.type === 'bite') {
|
||||
output.target = parseUser(data.account)
|
||||
output.bite_back = false
|
||||
if (data.bite)
|
||||
output.bite_back_id = data.bite.id
|
||||
|
||||
if (data.status) {
|
||||
output.type = "bite_note"
|
||||
output.status = parseStatus(data.status)
|
||||
output.action = output.status // TODO: Refactor, this is unneeded
|
||||
} else if (data.bite && data.bite.bite_back) {
|
||||
output.bite_back = true
|
||||
}
|
||||
}
|
||||
output.from_profile = parseUser(data.account)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ export const visibleTypes = store => {
|
|||
rootState.config.notificationVisibility.polls && 'poll',
|
||||
rootState.config.notificationVisibility.bites && 'bite',
|
||||
rootState.config.notificationVisibility.bites && 'bite_note',
|
||||
rootState.config.notificationVisibility.bites && 'bite_back',
|
||||
rootState.config.notificationVisibility.followRequest && 'follow_request_accepted',
|
||||
rootState.config.notificationVisibility.edits && 'update'
|
||||
].filter(_ => _))
|
||||
|
|
@ -112,6 +113,9 @@ export const prepareNotificationObject = (notification, i18n, store) => {
|
|||
case 'bite_note':
|
||||
i18nString = 'bit_note'
|
||||
break
|
||||
case 'bite_back':
|
||||
i18nString = 'bit_back'
|
||||
break
|
||||
case 'follow_request_accepted':
|
||||
i18nString = 'follow_request_accepted'
|
||||
break
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue