diff --git a/src/routes/_components/status/StatusToolbar.html b/src/routes/_components/status/StatusToolbar.html index a763b1c7..e15b23e2 100644 --- a/src/routes/_components/status/StatusToolbar.html +++ b/src/routes/_components/status/StatusToolbar.html @@ -19,7 +19,7 @@ ref:reblogIcon /> inReplyToId ? '#fa-reply-all' : '#fa-reply', - reblogLabel: ({ visibility }) => { + reblogLabel: ({ visibility, reblogged }) => { switch (visibility) { case 'private': return 'Cannot be boosted because this is followers-only' case 'direct': return 'Cannot be boosted because this is a direct message' default: - return 'Boost' + return reblogged ? 'Unboost' : 'Boost' } }, reblogIcon: ({ visibility }) => { @@ -193,6 +193,9 @@ } return originalStatus.reblogged }, + favoriteLabel: ({ favorited }) => ( + favorited ? 'Unfavorite' : 'Favorite' + ), favorited: ({ originalStatusId, $currentStatusModifications, originalStatus }) => { if ($currentStatusModifications && originalStatusId in $currentStatusModifications.favorites) { return $currentStatusModifications.favorites[originalStatusId] diff --git a/tests/spec/011-reblog-favorites-count.js b/tests/spec/011-reblog-favorites-count.js index 65a5df0a..57c2e4f7 100644 --- a/tests/spec/011-reblog-favorites-count.js +++ b/tests/spec/011-reblog-favorites-count.js @@ -15,7 +15,7 @@ test('shows favorites', async t => { .expect(getUrl()).contains('/statuses/') .expect(getFavoritesCount()).eql(2) .expect(favoritesCountElement.getAttribute('aria-label')).eql('Favorited 2 times') - .expect($('.icon-button[aria-label="Favorite"]').getAttribute('aria-pressed')).eql('true') + .expect($('.icon-button[aria-label="Unfavorite"]').getAttribute('aria-pressed')).eql('true') .click(favoritesCountElement) .expect(getUrl()).match(/\/statuses\/[^/]+\/favorites/) .expect($('.search-result-account-name').nth(0).innerText).eql('foobar')