mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 11:55:09 +08:00
keyValueStore isn't available in test
This commit is contained in:
parent
023fcb04b5
commit
c08d53f2dd
|
@ -262,7 +262,7 @@ export default createWidget('post-menu', {
|
||||||
const hiddenSetting = siteSettings.post_menu_hidden_items || '';
|
const hiddenSetting = siteSettings.post_menu_hidden_items || '';
|
||||||
const hiddenButtons = hiddenSetting.split('|').filter(s => !attrs.bookmarked || s !== 'bookmark');
|
const hiddenButtons = hiddenSetting.split('|').filter(s => !attrs.bookmarked || s !== 'bookmark');
|
||||||
|
|
||||||
if (currentUser) {
|
if (currentUser && keyValueStore) {
|
||||||
const likedPostId = keyValueStore.getInt("likedPostId");
|
const likedPostId = keyValueStore.getInt("likedPostId");
|
||||||
if (likedPostId === attrs.id) {
|
if (likedPostId === attrs.id) {
|
||||||
keyValueStore.remove("likedPostId");
|
keyValueStore.remove("likedPostId");
|
||||||
|
@ -387,10 +387,10 @@ export default createWidget('post-menu', {
|
||||||
},
|
},
|
||||||
|
|
||||||
like() {
|
like() {
|
||||||
const { attrs } = this;
|
const { attrs, currentUser, keyValueStore } = this;
|
||||||
|
|
||||||
if (!this.currentUser) {
|
if (!currentUser) {
|
||||||
this.keyValueStore.set({ key: "likedPostId", value: attrs.id });
|
keyValueStore && keyValueStore.set({ key: "likedPostId", value: attrs.id });
|
||||||
return this.sendWidgetAction('showLogin');
|
return this.sendWidgetAction('showLogin');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user