added foreign reaction capabilties (chuckya)
This commit is contained in:
parent
a9fdd913f3
commit
7f993ee538
3 changed files with 31 additions and 20 deletions
|
@ -11,7 +11,6 @@
|
|||
import RepostIcon from '../../../img/icons/repost.svg';
|
||||
import FavouriteIcon from '../../../img/icons/like.svg';
|
||||
import FavouriteIconFill from '../../../img/icons/like_fill.svg';
|
||||
import ReactIcon from '../../../img/icons/react.svg';
|
||||
import QuoteIcon from '../../../img/icons/quote.svg';
|
||||
import MoreIcon from '../../../img/icons/more.svg';
|
||||
|
||||
|
@ -45,23 +44,6 @@
|
|||
post.favourite_count = data.favourites_count;
|
||||
if (data.reactions) post.reactions = parseReactions(data.reactions);
|
||||
}
|
||||
|
||||
async function toggleReaction(reaction) {
|
||||
if (reaction.name.includes('@')) return;
|
||||
|
||||
let data;
|
||||
if (reaction.me)
|
||||
data = await api.unreactPost(get(server).host, get(app).token, post.id, reaction.name);
|
||||
else
|
||||
data = await api.reactPost(get(server).host, get(app).token, post.id, reaction.name);
|
||||
if (!data) {
|
||||
console.error(`Failed to favourite post ${post.id}`);
|
||||
return;
|
||||
}
|
||||
post.favourited = data.favourited;
|
||||
post.favourite_count = data.favourites_count;
|
||||
if (data.reactions) post.reactions = parseReactions(data.reactions);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="post-actions" aria-label="Post actions" on:mouseup|stopPropagation on:keydown|stopPropagation>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue