Skip to content

Commit a2b13f9

Browse files
patch(user): hide server join date in DMs
1 parent 4f46c31 commit a2b13f9

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

Swiftcord/Views/User/Avatar/UserAvatarView.swift

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,28 @@ struct UserAvatarView: View {
9494
.tint(.blue)
9595
}
9696

97-
Text("Member Since")
97+
Text(ctx.guild?.id.isDM == true ? "Discord Member Since" : "Member Since")
9898
.font(.headline)
9999
.textCase(.uppercase)
100100
HStack(spacing: 8) {
101101
Image("DiscordIcon").resizable().aspectRatio(contentMode: .fit).frame(width: 16)
102102
Text(user.id.createdAt?.formatted(.dateTime.day().month().year()) ?? "Unknown")
103103

104-
Circle().fill(Color(nsColor: .separatorColor)).frame(width: 4, height: 4)
105-
106-
if let iconURL = ctx.guild?.properties.iconURL(size: 32), let url = URL(string: iconURL) {
107-
BetterImageView(url: url).frame(width: 16).clipShape(Circle())
108-
} else {
109-
Text("\(ctx.guild?.properties.name ?? "")")
110-
.font(.caption)
111-
.fixedSize()
112-
.frame(width: 16, height: 16, alignment: .leading)
113-
.background(.gray.opacity(0.5))
114-
.clipShape(Circle())
104+
if let guild = ctx.guild, !guild.id.isDM {
105+
Circle().fill(Color(nsColor: .separatorColor)).frame(width: 4, height: 4)
106+
107+
if let iconURL = guild.properties.iconURL(size: 32), let url = URL(string: iconURL) {
108+
BetterImageView(url: url).frame(width: 16).clipShape(Circle())
109+
} else {
110+
Text("\(guild.properties.name)")
111+
.font(.caption)
112+
.fixedSize()
113+
.frame(width: 16, height: 16, alignment: .leading)
114+
.background(.gray.opacity(0.5))
115+
.clipShape(Circle())
116+
}
117+
Text(member?.joined_at.formatted(.dateTime.day().month().year()) ?? "Unknown")
115118
}
116-
Text(member?.joined_at.formatted(.dateTime.day().month().year()) ?? "Unknown")
117119
}
118120

119121
if guildID != "@me" {

0 commit comments

Comments
 (0)