mirror of https://github.com/M66B/FairEmail.git
Use answer name as subject
This commit is contained in:
parent
5f0c13f34c
commit
e28bf95149
|
@ -19,6 +19,8 @@ package eu.faircode.email;
|
|||
Copyright 2018-2019 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
@ -52,11 +54,16 @@ public class EntityAnswer implements Serializable {
|
|||
@NonNull
|
||||
public String text;
|
||||
|
||||
static String getAnswerText(DB db, long id, Address[] from) {
|
||||
static String getAnswerText(Context context, long id, Address[] from) {
|
||||
DB db = DB.getInstance(context);
|
||||
EntityAnswer answer = db.answer().getAnswer(id);
|
||||
if (answer == null)
|
||||
return null;
|
||||
|
||||
return getAnswerText(answer, from);
|
||||
}
|
||||
|
||||
static String getAnswerText(EntityAnswer answer, Address[] from) {
|
||||
String name = null;
|
||||
String email = null;
|
||||
String first = null;
|
||||
|
|
|
@ -298,7 +298,7 @@ public class EntityRule {
|
|||
if (identity == null)
|
||||
throw new IllegalArgumentException("Rule identity not found");
|
||||
|
||||
String body = EntityAnswer.getAnswerText(db, aid, message.from);
|
||||
String body = EntityAnswer.getAnswerText(context, aid, message.from);
|
||||
if (body == null)
|
||||
throw new IllegalArgumentException("Rule answer not found");
|
||||
|
||||
|
|
|
@ -2016,8 +2016,13 @@ public class FragmentCompose extends FragmentBase {
|
|||
body = args.getString("body", "");
|
||||
body = body.replaceAll("\\r?\\n", "<br />");
|
||||
|
||||
if (answer > 0)
|
||||
body = EntityAnswer.getAnswerText(db, answer, null) + body;
|
||||
if (answer > 0) {
|
||||
EntityAnswer a = db.answer().getAnswer(answer);
|
||||
if (a != null) {
|
||||
draft.subject = a.name;
|
||||
body = EntityAnswer.getAnswerText(a, null) + body;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Actions:
|
||||
// - reply
|
||||
|
@ -2108,7 +2113,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
|
||||
draft.plain_only = ref.plain_only;
|
||||
if (answer > 0)
|
||||
body = EntityAnswer.getAnswerText(db, answer, draft.to) + body;
|
||||
body = EntityAnswer.getAnswerText(context, answer, draft.to) + body;
|
||||
|
||||
EntityOperation.queue(context, ref, EntityOperation.SEEN, true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue