Replace findProperty and filterProperty with findBy and filterBy
This commit is contained in:
@@ -618,10 +618,10 @@ export default Ember.Controller.extend({
|
||||
let category;
|
||||
|
||||
if (!splitCategory[1]) {
|
||||
category = this.site.get('categories').findProperty('nameLower', splitCategory[0].toLowerCase());
|
||||
category = this.site.get('categories').findBy('nameLower', splitCategory[0].toLowerCase());
|
||||
} else {
|
||||
const categories = Discourse.Category.list();
|
||||
const mainCategory = categories.findProperty('nameLower', splitCategory[0].toLowerCase());
|
||||
const mainCategory = categories.findBy('nameLower', splitCategory[0].toLowerCase());
|
||||
category = categories.find(function(item) {
|
||||
return item && item.get('nameLower') === splitCategory[1].toLowerCase() && item.get('parent_category_id') === mainCategory.id;
|
||||
});
|
||||
|
||||
@@ -56,7 +56,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
|
||||
// Validate required fields
|
||||
let userFields = this.get('userFields');
|
||||
if (userFields) { userFields = userFields.filterProperty('field.required'); }
|
||||
if (userFields) { userFields = userFields.filterBy('field.required'); }
|
||||
if (!Ember.isEmpty(userFields)) {
|
||||
const anyEmpty = userFields.any(function(uf) {
|
||||
const val = uf.get('value');
|
||||
|
||||
@@ -20,7 +20,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
let flagsAvailable = this.get('model.flagsAvailable');
|
||||
|
||||
// "message user" option should be at the top
|
||||
const notifyUserIndex = flagsAvailable.indexOf(flagsAvailable.filterProperty('name_key', 'notify_user')[0]);
|
||||
const notifyUserIndex = flagsAvailable.indexOf(flagsAvailable.filterBy('name_key', 'notify_user')[0]);
|
||||
if (notifyUserIndex !== -1) {
|
||||
const notifyUser = flagsAvailable[notifyUserIndex];
|
||||
flagsAvailable.splice(notifyUserIndex, 1);
|
||||
@@ -93,7 +93,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
let postAction; // an instance of ActionSummary
|
||||
|
||||
if (!this.get('flagTopic')) {
|
||||
postAction = this.get('model.actions_summary').findProperty('id', this.get('selected.id'));
|
||||
postAction = this.get('model.actions_summary').findBy('id', this.get('selected.id'));
|
||||
} else {
|
||||
postAction = this.get('topicActionByName.' + this.get('selected.name_key'));
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
|
||||
authMessage: (function() {
|
||||
if (Ember.isEmpty(this.get('authenticate'))) return "";
|
||||
const method = findAll(this.siteSettings, this.capabilities, this.isMobileDevice).findProperty("name", this.get("authenticate"));
|
||||
const method = findAll(this.siteSettings, this.capabilities, this.isMobileDevice).findBy("name", this.get("authenticate"));
|
||||
if(method){
|
||||
return method.get('message');
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
|
||||
// Staff can edit fields that are not `editable`
|
||||
if (!this.get('currentUser.staff')) {
|
||||
siteUserFields = siteUserFields.filterProperty('editable', true);
|
||||
siteUserFields = siteUserFields.filterBy('editable', true);
|
||||
}
|
||||
return siteUserFields.sortBy('position').map(function(field) {
|
||||
const value = userFields ? userFields[field.get('id').toString()] : null;
|
||||
|
||||
@@ -765,7 +765,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||
const selectedReplies = this.get('selectedReplies');
|
||||
selectedReplies.removeObject(post);
|
||||
|
||||
const selectedReply = selectedReplies.findProperty('post_number', post.get('reply_to_post_number'));
|
||||
const selectedReply = selectedReplies.findBy('post_number', post.get('reply_to_post_number'));
|
||||
if (selectedReply) { selectedReplies.removeObject(selectedReply); }
|
||||
|
||||
this.set('allPostsSelected', false);
|
||||
@@ -774,7 +774,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||
postSelected(post) {
|
||||
if (this.get('allPostsSelected')) { return true; }
|
||||
if (this.get('selectedPosts').contains(post)) { return true; }
|
||||
if (this.get('selectedReplies').findProperty('post_number', post.get('reply_to_post_number'))) { return true; }
|
||||
if (this.get('selectedReplies').findBy('post_number', post.get('reply_to_post_number'))) { return true; }
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -41,7 +41,7 @@ export default Ember.Controller.extend({
|
||||
const siteUserFields = this.site.get('user_fields');
|
||||
if (!Ember.isEmpty(siteUserFields)) {
|
||||
const userFields = this.get('user.user_fields');
|
||||
return siteUserFields.filterProperty('show_on_user_card', true).sortBy('position').map(field => {
|
||||
return siteUserFields.filterBy('show_on_user_card', true).sortBy('position').map(field => {
|
||||
Ember.set(field, 'dasherized_name', field.get('name').dasherize());
|
||||
const value = userFields ? userFields[field.get('id')] : null;
|
||||
return Ember.isEmpty(value) ? null : Ember.Object.create({ value, field });
|
||||
|
||||
@@ -76,7 +76,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
const siteUserFields = this.site.get('user_fields');
|
||||
if (!Ember.isEmpty(siteUserFields)) {
|
||||
const userFields = this.get('model.user_fields');
|
||||
return siteUserFields.filterProperty('show_on_profile', true).sortBy('position').map(field => {
|
||||
return siteUserFields.filterBy('show_on_profile', true).sortBy('position').map(field => {
|
||||
field.dasherized_name = field.get('name').dasherize();
|
||||
const value = userFields ? userFields[field.get('id').toString()] : null;
|
||||
return Ember.isEmpty(value) ? null : Ember.Object.create({ value, field });
|
||||
|
||||
Reference in New Issue
Block a user