FIX: correctly checks user activation on use (#23793)

We can't have it computed only at start of the application as the state wouldn't most likely be false at this point in time.
This commit is contained in:
Joffrey JAFFEUX
2023-10-05 11:24:01 +02:00
committed by GitHub
parent ea9ad4dc0f
commit 9e5fc2e817
4 changed files with 12 additions and 11 deletions

View File

@@ -4,7 +4,6 @@ import { getOwner } from "@ember/application";
import { tracked } from "@glimmer/tracking";
import discourseLater from "discourse-common/lib/later";
import { action } from "@ember/object";
import { isTesting } from "discourse-common/config/environment";
import { inject as service } from "@ember/service";
import and from "truth-helpers/helpers/and";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
@@ -142,7 +141,7 @@ export default class ChatMessageActionsMobile extends Component {
fadeAndVibrate() {
discourseLater(this.#addFadeIn.bind(this));
if (this.capabilities.canVibrate && !isTesting()) {
if (this.capabilities.userHasBeenActive && this.capabilities.canVibrate) {
navigator.vibrate(5);
}
}

View File

@@ -7,7 +7,6 @@ import { BookmarkFormData } from "discourse/lib/bookmark";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { isTesting } from "discourse-common/config/environment";
import { clipboardCopy } from "discourse/lib/utilities";
import ChatMessageReaction, {
REACTIONS,
@@ -284,7 +283,7 @@ export default class ChatMessageInteractor {
return;
}
if (this.capabilities.canVibrate && !isTesting()) {
if (this.capabilities.userHasBeenActive && this.capabilities.canVibrate) {
navigator.vibrate(5);
}