mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
REFACTOR: Remove _.isEmpty
in favor of the existing version
This commit is contained in:
parent
65f6a92129
commit
115b3b6921
|
@ -1,6 +1,7 @@
|
|||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import { sanitize, emojiUnescape } from "discourse/lib/text";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
|
||||
export default Component.extend({
|
||||
size: "medium",
|
||||
|
@ -25,7 +26,7 @@ export default Component.extend({
|
|||
summary(size) {
|
||||
if (size === "large") {
|
||||
const longDescription = this.get("badge.long_description");
|
||||
if (!_.isEmpty(longDescription)) {
|
||||
if (!isEmpty(longDescription)) {
|
||||
return emojiUnescape(sanitize(longDescription));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import showModal from "discourse/lib/show-modal";
|
|||
import { Promise } from "rsvp";
|
||||
import { isTesting } from "discourse-common/config/environment";
|
||||
import { SKIP } from "discourse/lib/autocomplete";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
|
||||
// Our head can be a static string or a function that returns a string
|
||||
// based on input (like for numbered lists).
|
||||
|
@ -953,7 +954,7 @@ export default Component.extend({
|
|||
let selected = this._getSelected();
|
||||
const captures = selected.pre.match(/\B:(\w*)$/);
|
||||
|
||||
if (_.isEmpty(captures)) {
|
||||
if (isEmpty(captures)) {
|
||||
if (selected.pre.match(/\S$/)) {
|
||||
this._addText(selected, ` :${code}:`);
|
||||
} else {
|
||||
|
|
|
@ -14,6 +14,7 @@ import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
|
|||
import { formattedReminderTime, REMINDER_TYPES } from "discourse/lib/bookmark";
|
||||
import { AUTO_DELETE_PREFERENCES } from "discourse/models/bookmark";
|
||||
import bootbox from "bootbox";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
|
||||
// global shortcuts that interfere with these modal shortcuts, they are rebound when the
|
||||
// modal is closed
|
||||
|
@ -294,7 +295,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
|
||||
@discourseComputed("userTimezone")
|
||||
userHasTimezoneSet(userTimezone) {
|
||||
return !_.isEmpty(userTimezone);
|
||||
return !isEmpty(userTimezone);
|
||||
},
|
||||
|
||||
_saveBookmark() {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { SEARCH_PHRASE_REGEXP } from "discourse/lib/constants";
|
||||
import highlightHTML from "discourse/lib/highlight-html";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
|
||||
export const CLASS_NAME = "search-highlight";
|
||||
|
||||
export default function(elem, term, opts = {}) {
|
||||
if (!_.isEmpty(term)) {
|
||||
if (!isEmpty(term)) {
|
||||
// special case ignore "l" which is used for magic sorting
|
||||
let words = _.reject(
|
||||
term.match(new RegExp(`${SEARCH_PHRASE_REGEXP}|[^\\s]+`, "g")),
|
||||
|
|
|
@ -23,6 +23,7 @@ import Site from "discourse/models/site";
|
|||
import User from "discourse/models/user";
|
||||
import deprecated from "discourse-common/lib/deprecated";
|
||||
import bootbox from "bootbox";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
|
||||
// The actions the composer can take
|
||||
export const CREATE_TOPIC = "createTopic",
|
||||
|
@ -996,7 +997,7 @@ const Composer = RestModel.extend({
|
|||
// Furthermore calculating cooked is very complicated, especially since
|
||||
// we would need to handle oneboxes and other bits that are not even in the
|
||||
// engine, staging will just cause a blank post to render
|
||||
if (!_.isEmpty(createdPost.cooked)) {
|
||||
if (!isEmpty(createdPost.cooked)) {
|
||||
state = postStream.stagePost(createdPost, user);
|
||||
if (state === "alreadyStaging") {
|
||||
return;
|
||||
|
|
|
@ -323,7 +323,7 @@ I18n.enableVerboseLocalization = function() {
|
|||
if (!current) {
|
||||
current = keys[scope] = ++counter;
|
||||
var message = "Translation #" + current + ": " + scope;
|
||||
if (!_.isEmpty(value)) {
|
||||
if (value && Object.keys(value).length > 0) {
|
||||
message += ", parameters: " + JSON.stringify(value);
|
||||
}
|
||||
// eslint-disable-next-line no-console
|
||||
|
|
Loading…
Reference in New Issue
Block a user