Inline attachments required a content ID

This commit is contained in:
M66B 2019-06-22 14:32:42 +02:00
parent 23cc120c3a
commit af5b3ba467
4 changed files with 4 additions and 5 deletions

View File

@ -102,7 +102,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
} }
private void bindTo(EntityAttachment attachment) { private void bindTo(EntityAttachment attachment) {
view.setAlpha(attachment.isInline() ? Helper.LOW_LIGHT : 1.0f); view.setAlpha(attachment.isInline() || TextUtils.isEmpty(attachment.name) ? Helper.LOW_LIGHT : 1.0f);
ibDelete.setVisibility(readonly ? View.GONE : attachment.isInline() ? View.INVISIBLE : View.VISIBLE); ibDelete.setVisibility(readonly ? View.GONE : attachment.isInline() ? View.INVISIBLE : View.VISIBLE);
tvName.setText(attachment.name); tvName.setText(attachment.name);

View File

@ -1104,8 +1104,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean calendar = false; boolean calendar = false;
List<EntityAttachment> a = new ArrayList<>(); List<EntityAttachment> a = new ArrayList<>();
for (EntityAttachment attachment : attachments) { for (EntityAttachment attachment : attachments) {
boolean inline = (TextUtils.isEmpty(attachment.name) || boolean inline = (attachment.isInline() || TextUtils.isEmpty(attachment.name));
(attachment.isInline() && attachment.isImage()));
if (inline) if (inline)
has_inline = true; has_inline = true;
if (attachment.progress == null && !attachment.available) if (attachment.progress == null && !attachment.available)

View File

@ -91,7 +91,7 @@ public class EntityAttachment {
public String error; public String error;
boolean isInline() { boolean isInline() {
return (disposition != null && disposition.equalsIgnoreCase(Part.INLINE)); return (disposition != null && disposition.equalsIgnoreCase(Part.INLINE) && cid != null);
} }
boolean isImage() { boolean isImage() {

View File

@ -2620,7 +2620,7 @@ public class FragmentCompose extends FragmentBase {
} }
for (EntityAttachment attachment : new ArrayList<>(attachments)) for (EntityAttachment attachment : new ArrayList<>(attachments))
if (attachment.isInline() && attachment.cid != null && !cids.contains(attachment.cid)) { if (attachment.isInline() && !cids.contains(attachment.cid)) {
Log.i("Removing unused inline attachment cid=" + attachment.cid); Log.i("Removing unused inline attachment cid=" + attachment.cid);
db.attachment().deleteAttachment(attachment.id); db.attachment().deleteAttachment(attachment.id);
} }