isolate bi-directional text in display name

This commit is contained in:
sk
2023-10-17 01:03:06 +02:00
parent 92d7ae67ef
commit 5840c94395

View File

@@ -6,8 +6,6 @@ import android.text.TextUtils;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import org.joinmastodon.android.api.ObjectValidationException; import org.joinmastodon.android.api.ObjectValidationException;
import org.joinmastodon.android.api.RequiredField;
import org.joinmastodon.android.api.requests.instance.GetInstance;
import org.parceler.Parcel; import org.parceler.Parcel;
import java.time.Instant; import java.time.Instant;
@@ -15,9 +13,6 @@ import java.time.LocalDate;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import me.grishka.appkit.api.Callback;
import me.grishka.appkit.api.ErrorResponse;
/** /**
* Represents a user of Mastodon and their associated profile. * Represents a user of Mastodon and their associated profile.
*/ */
@@ -163,26 +158,27 @@ public class Account extends BaseModel implements Searchable{
if(fields!=null){ if(fields!=null){
for(AccountField f:fields) for(AccountField f:fields)
f.postprocess(); f.postprocess();
} else { }else{
fields = Collections.emptyList(); fields=Collections.emptyList();
} }
if(emojis!=null){ if(emojis!=null){
for(Emoji e:emojis) for(Emoji e:emojis)
e.postprocess(); e.postprocess();
} else { }else{
emojis = Collections.emptyList(); emojis=Collections.emptyList();
} }
if(moved!=null) if(moved!=null)
moved.postprocess(); moved.postprocess();
if(fqn == null) fqn = getFullyQualifiedName(); if(fqn==null) fqn=getFullyQualifiedName();
if(id == null) id = ""; if(id==null) id="";
if(username == null) username = ""; if(username==null) username="";
if(TextUtils.isEmpty(displayName)) if(TextUtils.isEmpty(displayName))
displayName = !TextUtils.isEmpty(username) ? username : ""; displayName=!TextUtils.isEmpty(username) ? username : "";
if(acct == null) acct = ""; if(acct==null) acct="";
if(url == null) url = ""; if(url==null) url="";
if(note == null) note = ""; if(note==null) note="";
if(avatar == null) avatar = ""; if(avatar==null) avatar="";
if(displayName!=null) displayName='\u2068'+displayName+'\u2069';
} }
public boolean isLocal(){ public boolean isLocal(){