Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 420bd0b

Browse files
jainkuniyatimabbott
authored andcommitted
Fix title when narrowed to self.
Included a case when narrowed to self, then list size is 1, and set title as user name.
1 parent 8449ec5 commit 420bd0b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/src/main/java/com/zulip/android/activities/ZulipActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,8 +1748,12 @@ protected void narrow(final Stream stream) {
17481748
doNarrow(new NarrowFilterStream(stream, null));
17491749
}
17501750

1751-
doNarrow(new NarrowFilterPM(Arrays.asList(app.getYou(), person)));
17521751
private void narrowPMWith(final Person person) {
1752+
List<Person> list = new ArrayList<>();
1753+
list.add(person);
1754+
if (!person.getEmail().equals(app.getYou().getEmail()))
1755+
list.add(app.getYou());
1756+
doNarrow(new NarrowFilterPM(list));
17531757
onNarrowFillSendBoxPrivate(new Person[]{person},false);
17541758
}
17551759

app/src/main/java/com/zulip/android/filters/NarrowFilterPM.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ public boolean matches(Message msg) {
7373
public String getTitle() {
7474
ArrayList<String> names = new ArrayList<>();
7575
for (Person person : people) {
76-
if (!person.equals(ZulipApp.get().getYou()) || people.size() == 1) { //If PM to self then show title as your name
76+
// If PM to self then show title as your name
77+
// people size == 1 implies PM to self
78+
if (person.getId() != ZulipApp.get().getYou().getId() || people.size() == 1) {
7779
names.add(person.getName());
7880
}
7981
}

0 commit comments

Comments
 (0)