keyValueStore isn't available in test

This commit is contained in:
Régis Hanol 2017-12-06 23:28:28 +01:00
parent 023fcb04b5
commit c08d53f2dd
1 changed files with 4 additions and 4 deletions

View File

@ -262,7 +262,7 @@ export default createWidget('post-menu', {
const hiddenSetting = siteSettings.post_menu_hidden_items || '';
const hiddenButtons = hiddenSetting.split('|').filter(s => !attrs.bookmarked || s !== 'bookmark');
if (currentUser) {
if (currentUser && keyValueStore) {
const likedPostId = keyValueStore.getInt("likedPostId");
if (likedPostId === attrs.id) {
keyValueStore.remove("likedPostId");
@ -387,10 +387,10 @@ export default createWidget('post-menu', {
},
like() {
const { attrs } = this;
const { attrs, currentUser, keyValueStore } = this;
if (!this.currentUser) {
this.keyValueStore.set({ key: "likedPostId", value: attrs.id });
if (!currentUser) {
keyValueStore && keyValueStore.set({ key: "likedPostId", value: attrs.id });
return this.sendWidgetAction('showLogin');
}