Skip to content

Commit

Permalink
Merge pull request #1916 from pantasystem/feature/#1915/post-notifica…
Browse files Browse the repository at this point in the history
…tion

投稿の通知を表示できるようにしました
  • Loading branch information
pantasystem authored Oct 8, 2023
2 parents 2684d62 + b1a5c3e commit cb39c68
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@ import net.pantasystem.milktea.data.infrastructure.toGroup
import net.pantasystem.milktea.model.account.Account
import net.pantasystem.milktea.model.group.InvitationId
import net.pantasystem.milktea.model.note.Note
import net.pantasystem.milktea.model.notification.*
import net.pantasystem.milktea.model.notification.FollowNotification
import net.pantasystem.milktea.model.notification.FollowRequestAcceptedNotification
import net.pantasystem.milktea.model.notification.GroupInvitedNotification
import net.pantasystem.milktea.model.notification.MentionNotification
import net.pantasystem.milktea.model.notification.Notification
import net.pantasystem.milktea.model.notification.PollEndedNotification
import net.pantasystem.milktea.model.notification.PollVoteNotification
import net.pantasystem.milktea.model.notification.QuoteNotification
import net.pantasystem.milktea.model.notification.ReactionNotification
import net.pantasystem.milktea.model.notification.ReceiveFollowRequestNotification
import net.pantasystem.milktea.model.notification.RenoteNotification
import net.pantasystem.milktea.model.notification.ReplyNotification
import net.pantasystem.milktea.model.notification.PostNotification
import net.pantasystem.milktea.model.notification.UnknownNotification
import net.pantasystem.milktea.model.user.User
import javax.inject.Inject
import javax.inject.Singleton
Expand Down Expand Up @@ -144,6 +157,18 @@ class NotificationDTOEntityConverter @Inject constructor(
InvitationId(account.accountId, notificationDTO.invitation!!.id),
)
}
"note" -> {
PostNotification(
id,
notificationDTO.createdAt,
User.Id(account.accountId, notificationDTO.userId!!),
Note.Id(
account.accountId,
notificationDTO.note?.id ?: throw IllegalStateException("noteId参照不能")
),
notificationDTO.isRead ?: true
)
}
else -> {
return UnknownNotification(
id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fun MstNotificationDTO.toModel(a: Account, isRead: Boolean): Notification {
)
}
MstNotificationDTO.NotificationType.Status -> {
StatusNotification(
PostNotification(
createdAt = createdAt,
id = id,
userId = userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class NotificationMessageScope(val context: Context) {
R.string.notification_favorited_by,
user?.displayUserName ?: ""
)
is StatusNotification -> context.getString(
is PostNotification -> context.getString(
R.string.notification_posted_by,
user?.displayUserName ?: ""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class NotificationViewData(
is GroupInvitedNotification -> Type.GROUP_INVITED
is UnknownNotification -> Type.UNKNOWN
is FavoriteNotification -> Type.FAVORITE
is StatusNotification -> Type.STATUS
is PostNotification -> Type.STATUS
}
val statusType: String = type.default

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ data class MentionNotification(
}
}

data class StatusNotification(
data class PostNotification(
override val id: Id,

override val createdAt: Instant,
Expand Down

0 comments on commit cb39c68

Please sign in to comment.