mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 16:23:44 +08:00
DEV: DRY up wavingHandUrl code.
Allows for resuse in other controllers and components.
This commit is contained in:
parent
51483e1aef
commit
4a41f72f09
|
@ -22,8 +22,7 @@ import { isEmpty } from "@ember/utils";
|
|||
import { notEmpty } from "@ember/object/computed";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import { helperContext } from "discourse-common/lib/helpers";
|
||||
import { emojiBasePath } from "discourse/lib/settings";
|
||||
import { wavingHandURL } from "discourse/lib/waving-hand-url";
|
||||
|
||||
export default Controller.extend(
|
||||
ModalFunctionality,
|
||||
|
@ -80,13 +79,7 @@ export default Controller.extend(
|
|||
},
|
||||
|
||||
@discourseComputed()
|
||||
wavingHandURL() {
|
||||
const emojiSet = helperContext().siteSettings.emoji_set;
|
||||
|
||||
// random number between 2 -6 to render multiple skin tone waving hands
|
||||
const random = Math.floor(Math.random() * (7 - 2) + 2);
|
||||
return getURL(`${emojiBasePath()}/${emojiSet}/wave/${random}.png`);
|
||||
},
|
||||
wavingHandURL: () => wavingHandURL(),
|
||||
|
||||
@discourseComputed(
|
||||
"userFields",
|
||||
|
|
|
@ -18,8 +18,7 @@ import { getWebauthnCredential } from "discourse/lib/webauthn";
|
|||
import { isEmpty } from "@ember/utils";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import { helperContext } from "discourse-common/lib/helpers";
|
||||
import { emojiBasePath } from "discourse/lib/settings";
|
||||
import { wavingHandURL } from "discourse/lib/waving-hand-url";
|
||||
|
||||
// This is happening outside of the app via popup
|
||||
const AuthErrors = [
|
||||
|
@ -67,13 +66,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
},
|
||||
|
||||
@discourseComputed()
|
||||
wavingHandURL() {
|
||||
const emojiSet = helperContext().siteSettings.emoji_set;
|
||||
|
||||
// random number between 2 -6 to render multiple skin tone waving hands
|
||||
const random = Math.floor(Math.random() * (7 - 2) + 2);
|
||||
return getURL(`${emojiBasePath()}/${emojiSet}/wave/${random}.png`);
|
||||
},
|
||||
wavingHandURL: () => wavingHandURL(),
|
||||
|
||||
@discourseComputed("showSecondFactor", "showSecurityKey")
|
||||
secondFactorClass(showSecondFactor, showSecurityKey) {
|
||||
|
|
11
app/assets/javascripts/discourse/app/lib/waving-hand-url.js
Normal file
11
app/assets/javascripts/discourse/app/lib/waving-hand-url.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { helperContext } from "discourse-common/lib/helpers";
|
||||
import { emojiBasePath } from "discourse/lib/settings";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
|
||||
export function wavingHandURL() {
|
||||
const emojiSet = helperContext().siteSettings.emoji_set;
|
||||
|
||||
// random number between 2 -6 to render multiple skin tone waving hands
|
||||
const random = Math.floor(Math.random() * (7 - 2) + 2);
|
||||
return getURL(`${emojiBasePath()}/${emojiSet}/wave/${random}.png`);
|
||||
}
|
Loading…
Reference in New Issue
Block a user