Notification bell (#2012)
* Add notification bell button, API endpoints and new relationship field * Add notification type for subscriptions * Add subscriptions to legacy notification filtering * Update schemas * Fix build * Make rewrite static method into method of Notification class, fix getNotificationText * Mastodon wording for subscriptions
This commit is contained in:
parent
a917e0dad8
commit
b91a0aceeb
18 changed files with 970 additions and 33 deletions
|
@ -32,7 +32,8 @@ data class Notification(
|
|||
FAVOURITE("favourite"),
|
||||
FOLLOW("follow"),
|
||||
FOLLOW_REQUEST("follow_request"),
|
||||
POLL("poll");
|
||||
POLL("poll"),
|
||||
STATUS("status");
|
||||
|
||||
companion object {
|
||||
|
||||
|
@ -44,7 +45,7 @@ data class Notification(
|
|||
}
|
||||
return UNKNOWN
|
||||
}
|
||||
val asList = listOf(MENTION, REBLOG, FAVOURITE, FOLLOW, FOLLOW_REQUEST, POLL)
|
||||
val asList = listOf(MENTION, REBLOG, FAVOURITE, FOLLOW, FOLLOW_REQUEST, POLL, STATUS)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
|
@ -72,4 +73,14 @@ data class Notification(
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// for Pleroma compatibility that uses Mention type
|
||||
fun rewriteToStatusTypeIfNeeded(accountId: String) : Notification {
|
||||
if (type == Type.MENTION && status != null) {
|
||||
return if (status.mentions.any {
|
||||
it.id == accountId
|
||||
}) this else copy(type = Type.STATUS)
|
||||
}
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ data class Relationship (
|
|||
@SerializedName("muting_notifications") val mutingNotifications: Boolean,
|
||||
val requested: Boolean,
|
||||
@SerializedName("showing_reblogs") val showingReblogs: Boolean,
|
||||
val subscribing: Boolean? = null, // Pleroma extension
|
||||
@SerializedName("domain_blocking") val blockingDomain: Boolean,
|
||||
val note: String? // nullable for backward compatibility / feature detection
|
||||
val note: String?, // nullable for backward compatibility / feature detection
|
||||
val notifying: Boolean? // since 3.3.0rc
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue