Skip to content

Commit

Permalink
Fix reaction tooltip for offchain communities (#33)
Browse files Browse the repository at this point in the history
Co-authored-by: Raymond Zhong <raykyri@gmail.com>
  • Loading branch information
dillchen and raykyri authored Apr 24, 2020
1 parent 9a89092 commit b74e8d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/scripts/controllers/server/reactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const modelFromServer = (reaction) => {
reaction.reaction,
reaction.thread_id,
reaction.comment_id,
reaction.Address.chain,
);
};

Expand Down
4 changes: 3 additions & 1 deletion client/scripts/models/OffchainReaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ class OffchainReaction<T extends IUniqueId> {
public readonly reaction: string;
public readonly threadId: number | string;
public readonly commentId: number | string;
public readonly author_chain: string;

constructor(id, author, chain, community, reaction, threadId, communityId) {
constructor(id, author, chain, community, reaction, threadId, communityId, author_chain) {
this.id = id;
this.author = author;
this.chain = chain;
this.community = community;
this.reaction = reaction;
this.threadId = threadId;
this.commentId = communityId;
this.author_chain = author_chain;
}
}

Expand Down
3 changes: 2 additions & 1 deletion client/scripts/views/components/reaction_button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const ReactionButton: m.Component<IAttrs, IState> = {
if (hasReacted) hasReactedType = rxn.reaction;

const reactors = (likes || dislikes).slice(0, MAX_VISIBLE_REACTING_ACCOUNTS).map((rxn_) => {
return m('.reacting-user', m(User, { user: [rxn_.author, app.activeChainId()], linkify: true }));
return m('.reacting-user', m(User, { user: [rxn_.author, rxn_.author_chain], linkify: true }));
});
if (reactors.length < (likes || dislikes).length) {
const diff = (likes || dislikes).length - reactors.length;
Expand All @@ -58,6 +58,7 @@ const ReactionButton: m.Component<IAttrs, IState> = {
e.preventDefault();
e.stopPropagation();
if (disabled) return;
// if it's a community use the app.vm.activeAccount.chain.id instead of author chain
const chainId = app.activeCommunityId() ? null : app.activeChainId();
const communityId = app.activeCommunityId();
if (hasReacted) {
Expand Down

0 comments on commit b74e8d8

Please sign in to comment.