diff --git a/Pachyderm/Sources/Pachyderm/Model/Mention.swift b/Pachyderm/Sources/Pachyderm/Model/Mention.swift index 49a58cc5..cde4c7a8 100644 --- a/Pachyderm/Sources/Pachyderm/Model/Mention.swift +++ b/Pachyderm/Sources/Pachyderm/Model/Mention.swift @@ -9,14 +9,14 @@ import Foundation import WebURL -public class Mention: Codable { +public struct Mention: Codable { public let url: WebURL public let username: String public let acct: String /// The instance-local ID of the user being mentioned. public let id: String - public required init(from decoder: Decoder) throws { + public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.username = try container.decode(String.self, forKey: .username) self.acct = try container.decode(String.self, forKey: .acct) diff --git a/Tusker/Views/StatusContentTextView.swift b/Tusker/Views/StatusContentTextView.swift index d6eaa204..2db13a98 100644 --- a/Tusker/Views/StatusContentTextView.swift +++ b/Tusker/Views/StatusContentTextView.swift @@ -26,8 +26,11 @@ class StatusContentTextView: ContentTextView { let mastodonController = mastodonController, let status = mastodonController.persistentContainer.status(for: statusID) { mention = status.mentions.first { (mention) in - // Mastodon and Pleroma include the @ in the text, GNU Social does not - (text.dropFirst() == mention.username || text == mention.username) && url.host == mention.url.host!.serialized + url.host == mention.url.host!.serialized && ( + text.dropFirst() == mention.username // Mastodon and Pleroma include @ in the text + || text.dropFirst() == mention.acct // Misskey includes @ and uses the whole acct + || text == mention.username // GNU Social does not include the @ in the text, so we don't need to drop it + ) } } else { mention = nil