mirror of
https://git.notfire.cc/notfire/akkoma-fe.git
synced 2026-01-11 05:23:16 -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`
|
- download by entering `tools/` and running `python3 download_ruffle.py`
|
||||||
|
|
||||||
### also of note for anyone running this fork
|
### also of note for anyone running this fork
|
||||||
- aside from the stuff mentioned above, the following features will require patches to work:
|
n/a
|
||||||
- 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))
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,10 @@ const Notification = {
|
||||||
})
|
})
|
||||||
|
|
||||||
return isFiltered
|
return isFiltered
|
||||||
|
},
|
||||||
|
biteBack () {
|
||||||
|
let id = this.notification.bite_back_id
|
||||||
|
return this.$store.state.api.backendInteractor.biteBack({ id })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@
|
||||||
{{ ' ' }}
|
{{ ' ' }}
|
||||||
<small>{{ $t('notifications.follow_request') }}</small>
|
<small>{{ $t('notifications.follow_request') }}</small>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="notification.type === 'bite'">
|
<span v-if="notification.type === 'bite' && notification.bite_back === false">
|
||||||
<FAIcon
|
<FAIcon
|
||||||
class="type-icon"
|
class="type-icon"
|
||||||
icon="tooth"
|
icon="tooth"
|
||||||
|
|
@ -127,6 +127,14 @@
|
||||||
{{ ' ' }}
|
{{ ' ' }}
|
||||||
<small>{{ $t('notifications.bit_note') }}</small>
|
<small>{{ $t('notifications.bit_note') }}</small>
|
||||||
</span>
|
</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'">
|
<span v-if="notification.type === 'update'">
|
||||||
<FAIcon
|
<FAIcon
|
||||||
class="type-icon"
|
class="type-icon"
|
||||||
|
|
@ -260,6 +268,16 @@
|
||||||
|
|
||||||
class="move-text"
|
class="move-text"
|
||||||
>
|
>
|
||||||
|
<button
|
||||||
|
class="btn button-default"
|
||||||
|
@click="biteBack"
|
||||||
|
>
|
||||||
|
{{ $t('notifications.bite_back') }}
|
||||||
|
<FAIcon
|
||||||
|
class="type-icon"
|
||||||
|
icon="tooth"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<StatusContent
|
<StatusContent
|
||||||
|
|
|
||||||
|
|
@ -328,7 +328,9 @@
|
||||||
},
|
},
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"bit": "bit you!",
|
"bit": "bit you!",
|
||||||
|
"bit_back": "bit back!",
|
||||||
"bit_note": "bit your note!",
|
"bit_note": "bit your note!",
|
||||||
|
"bite_back": "Bite back",
|
||||||
"broken_favorite": "Unknown post, searching for it…",
|
"broken_favorite": "Unknown post, searching for it…",
|
||||||
"edited": "edited a post",
|
"edited": "edited a post",
|
||||||
"error": "Error fetching notifications: {0}",
|
"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_UNBLOCK_USER_URL = id => `/api/v1/accounts/${id}/unblock`
|
||||||
const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute`
|
const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute`
|
||||||
const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute`
|
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_USER_URL = id => `/api/v1/users/${id}/bite`
|
||||||
const MASTODON_BITE_NOTE_URL = id => `/api/v1/statuses/${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`
|
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())
|
}).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 }) => {
|
const biteUser = ({ id, credentials }) => {
|
||||||
return fetch(MASTODON_BITE_USER_URL(id), {
|
return fetch(MASTODON_BITE_USER_URL(id), {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
|
|
@ -330,7 +338,6 @@ const biteNote = ({ id, credentials }) => {
|
||||||
}).then((data) => data.json())
|
}).then((data) => data.json())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const removeUserFromFollowers = ({ id, credentials }) => {
|
const removeUserFromFollowers = ({ id, credentials }) => {
|
||||||
return fetch(MASTODON_REMOVE_USER_FROM_FOLLOWERS(id), {
|
return fetch(MASTODON_REMOVE_USER_FROM_FOLLOWERS(id), {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
|
|
@ -1786,6 +1793,7 @@ const apiService = {
|
||||||
unmuteConversation,
|
unmuteConversation,
|
||||||
blockUser,
|
blockUser,
|
||||||
unblockUser,
|
unblockUser,
|
||||||
|
biteBack,
|
||||||
biteUser,
|
biteUser,
|
||||||
biteNote,
|
biteNote,
|
||||||
removeUserFromFollowers,
|
removeUserFromFollowers,
|
||||||
|
|
|
||||||
|
|
@ -426,11 +426,16 @@ export const parseNotification = (data) => {
|
||||||
}
|
}
|
||||||
if (output.type === 'bite') {
|
if (output.type === 'bite') {
|
||||||
output.target = parseUser(data.account)
|
output.target = parseUser(data.account)
|
||||||
|
output.bite_back = false
|
||||||
|
if (data.bite)
|
||||||
|
output.bite_back_id = data.bite.id
|
||||||
|
|
||||||
if (data.status) {
|
if (data.status) {
|
||||||
output.type = "bite_note"
|
output.type = "bite_note"
|
||||||
output.status = parseStatus(data.status)
|
output.status = parseStatus(data.status)
|
||||||
output.action = output.status // TODO: Refactor, this is unneeded
|
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)
|
output.from_profile = parseUser(data.account)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export const visibleTypes = store => {
|
||||||
rootState.config.notificationVisibility.polls && 'poll',
|
rootState.config.notificationVisibility.polls && 'poll',
|
||||||
rootState.config.notificationVisibility.bites && 'bite',
|
rootState.config.notificationVisibility.bites && 'bite',
|
||||||
rootState.config.notificationVisibility.bites && 'bite_note',
|
rootState.config.notificationVisibility.bites && 'bite_note',
|
||||||
|
rootState.config.notificationVisibility.bites && 'bite_back',
|
||||||
rootState.config.notificationVisibility.followRequest && 'follow_request_accepted',
|
rootState.config.notificationVisibility.followRequest && 'follow_request_accepted',
|
||||||
rootState.config.notificationVisibility.edits && 'update'
|
rootState.config.notificationVisibility.edits && 'update'
|
||||||
].filter(_ => _))
|
].filter(_ => _))
|
||||||
|
|
@ -112,6 +113,9 @@ export const prepareNotificationObject = (notification, i18n, store) => {
|
||||||
case 'bite_note':
|
case 'bite_note':
|
||||||
i18nString = 'bit_note'
|
i18nString = 'bit_note'
|
||||||
break
|
break
|
||||||
|
case 'bite_back':
|
||||||
|
i18nString = 'bit_back'
|
||||||
|
break
|
||||||
case 'follow_request_accepted':
|
case 'follow_request_accepted':
|
||||||
i18nString = 'follow_request_accepted'
|
i18nString = 'follow_request_accepted'
|
||||||
break
|
break
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue