mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 18:15:55 +08:00
REFACTOR: Remove _.first
from codebase
This commit is contained in:
parent
55c9c54b8b
commit
66021abe41
|
@ -16,7 +16,7 @@ export function currentThemeKey() {
|
|||
|
||||
export function currentThemeIds() {
|
||||
const themeIds = [];
|
||||
const elem = _.first($(keySelector));
|
||||
const elem = $(keySelector)[0];
|
||||
if (elem) {
|
||||
elem.content.split(",").forEach(num => {
|
||||
num = parseInt(num, 10);
|
||||
|
|
|
@ -145,8 +145,12 @@ export default RestModel.extend({
|
|||
**/
|
||||
@discourseComputed("posts.[]", "stream.[]")
|
||||
previousWindow() {
|
||||
if (!this.posts) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// If we can't find the last post loaded, bail
|
||||
const firstPost = _.first(this.posts);
|
||||
const firstPost = this.posts[0];
|
||||
if (!firstPost) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -29,8 +29,9 @@ export default createPMRoute("groups", "private-messages-groups").extend({
|
|||
const split = model.get("filter").split("/");
|
||||
const groupName = split[split.length - 2];
|
||||
this.set("groupName", groupName);
|
||||
const groups = this.modelFor("user").get("groups");
|
||||
const group = _.first(groups.filterBy("name", groupName));
|
||||
const group = this.modelFor("user")
|
||||
.get("groups")
|
||||
.filterBy("name", groupName)[0];
|
||||
this.controllerFor("user-private-messages").set("group", group);
|
||||
},
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ export default createPMRoute("groups", "private-messages-groups").extend({
|
|||
afterModel(model) {
|
||||
const groupName = _.last(model.get("filter").split("/"));
|
||||
this.set("groupName", groupName);
|
||||
const groups = this.modelFor("user").get("groups");
|
||||
const group = _.first(groups.filterBy("name", groupName));
|
||||
const group = this.modelFor("user")
|
||||
.get("groups")
|
||||
.filterBy("name", groupName)[0];
|
||||
this.controllerFor("user-private-messages").set("group", group);
|
||||
},
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ QUnit.assert.present = function(actual, message) {
|
|||
};
|
||||
|
||||
QUnit.assert.containsInstance = function(collection, klass, message) {
|
||||
const result = klass.detectInstance(_.first(collection));
|
||||
const result = klass.detectInstance(collection[0]);
|
||||
this.pushResult({
|
||||
result,
|
||||
message
|
||||
|
|
Loading…
Reference in New Issue
Block a user