Place new reaction where server specified it

This commit is contained in:
Jacocococo 2024-08-19 17:26:33 +02:00
parent 309d27242d
commit 5d411e842e
1 changed files with 5 additions and 1 deletions

View File

@ -276,7 +276,11 @@ public class EmojiReactionsStatusDisplayItem extends StatusDisplayItem {
item.createRequest(emoji, existing==null ? 1 : existing.count, false, null, (status)->{
resetBtn.run();
if(finalExisting==null){
int pos=item.status.reactions.size();
int pos=status.reactions.stream()
.filter(r->r.name.equals(info!=null ? info.shortcode : emoji))
.findFirst()
.map(r->status.reactions.indexOf(r))
.orElse(item.status.reactions.size());
boolean previouslyEmpty=item.status.reactions.isEmpty();
item.status.reactions.add(pos, info!=null ? EmojiReaction.of(info, me) : EmojiReaction.of(emoji, me));
if(previouslyEmpty)