Replace `findProperty` and `filterProperty` with `findBy` and `filterBy`
This commit is contained in:
parent
68b559d501
commit
7953a53cc5
|
@ -9,7 +9,7 @@ export default Ember.Controller.extend({
|
||||||
@computed('embedding.embeddable_hosts.@each.isCreated')
|
@computed('embedding.embeddable_hosts.@each.isCreated')
|
||||||
showSecondary() {
|
showSecondary() {
|
||||||
const hosts = this.get('embedding.embeddable_hosts');
|
const hosts = this.get('embedding.embeddable_hosts');
|
||||||
return hosts.length && hosts.findProperty('isCreated');
|
return hosts.length && hosts.findBy('isCreated');
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed('embedding.base_url')
|
@computed('embedding.base_url')
|
||||||
|
|
|
@ -5,7 +5,7 @@ export default Ember.Controller.extend({
|
||||||
filteredContent: function() {
|
filteredContent: function() {
|
||||||
if (!this.get('categoryNameKey')) { return []; }
|
if (!this.get('categoryNameKey')) { return []; }
|
||||||
|
|
||||||
const category = (this.get('adminSiteSettings.model') || []).findProperty('nameKey', this.get('categoryNameKey'));
|
const category = (this.get('adminSiteSettings.model') || []).findBy('nameKey', this.get('categoryNameKey'));
|
||||||
if (category) {
|
if (category) {
|
||||||
return category.siteSettings;
|
return category.siteSettings;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -19,7 +19,7 @@ export default Ember.Controller.extend({
|
||||||
selectedCount: function() {
|
selectedCount: function() {
|
||||||
var model = this.get('model');
|
var model = this.get('model');
|
||||||
if (!model || !model.length) return 0;
|
if (!model || !model.length) return 0;
|
||||||
return model.filterProperty('selected').length;
|
return model.filterBy('selected').length;
|
||||||
}.property('model.@each.selected'),
|
}.property('model.@each.selected'),
|
||||||
|
|
||||||
selectAllChanged: function() {
|
selectAllChanged: function() {
|
||||||
|
@ -52,14 +52,14 @@ export default Ember.Controller.extend({
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
approveUsers: function() {
|
approveUsers: function() {
|
||||||
AdminUser.bulkApprove(this.get('model').filterProperty('selected'));
|
AdminUser.bulkApprove(this.get('model').filterBy('selected'));
|
||||||
this._refreshUsers();
|
this._refreshUsers();
|
||||||
},
|
},
|
||||||
|
|
||||||
rejectUsers: function() {
|
rejectUsers: function() {
|
||||||
var maxPostAge = this.siteSettings.delete_user_max_post_age;
|
var maxPostAge = this.siteSettings.delete_user_max_post_age;
|
||||||
var controller = this;
|
var controller = this;
|
||||||
AdminUser.bulkReject(this.get('model').filterProperty('selected')).then(function(result){
|
AdminUser.bulkReject(this.get('model').filterBy('selected')).then(function(result){
|
||||||
var message = I18n.t("admin.users.reject_successful", {count: result.success});
|
var message = I18n.t("admin.users.reject_successful", {count: result.success});
|
||||||
if (result.failed > 0) {
|
if (result.failed > 0) {
|
||||||
message += ' ' + I18n.t("admin.users.reject_failures", {count: result.failed});
|
message += ' ' + I18n.t("admin.users.reject_failures", {count: result.failed});
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default Ember.Route.extend({
|
||||||
name: I18n.t('admin.badges.new_badge')
|
name: I18n.t('admin.badges.new_badge')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return this.modelFor('adminBadges').findProperty('id', parseInt(params.badge_id));
|
return this.modelFor('adminBadges').findBy('id', parseInt(params.badge_id));
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export default Ember.Route.extend({
|
export default Ember.Route.extend({
|
||||||
model(params) {
|
model(params) {
|
||||||
const all = this.modelFor('adminCustomizeCssHtml');
|
const all = this.modelFor('adminCustomizeCssHtml');
|
||||||
const model = all.findProperty('id', parseInt(params.site_customization_id));
|
const model = all.findBy('id', parseInt(params.site_customization_id));
|
||||||
return model ? { model, section: params.section } : this.replaceWith('adminCustomizeCssHtml.index');
|
return model ? { model, section: params.section } : this.replaceWith('adminCustomizeCssHtml.index');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { scrollTop } from 'discourse/mixins/scroll-top';
|
||||||
export default Ember.Route.extend({
|
export default Ember.Route.extend({
|
||||||
model(params) {
|
model(params) {
|
||||||
const all = this.modelFor('adminCustomizeEmailTemplates');
|
const all = this.modelFor('adminCustomizeEmailTemplates');
|
||||||
return all.findProperty('id', params.id);
|
return all.findBy('id', params.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, emailTemplate) {
|
setupController(controller, emailTemplate) {
|
||||||
|
|
|
@ -7,8 +7,7 @@ export default Discourse.Route.extend({
|
||||||
return Group.create({ automatic: false, visible: true });
|
return Group.create({ automatic: false, visible: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
const group = this.modelFor('adminGroupsType')
|
const group = this.modelFor('adminGroupsType').findBy('name', params.name);
|
||||||
.findProperty('name', params.name);
|
|
||||||
|
|
||||||
if (!group) { return this.transitionTo('adminGroups.index'); }
|
if (!group) { return this.transitionTo('adminGroups.index'); }
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default Ember.Component.extend({
|
||||||
target = target.find('a');
|
target = target.find('a');
|
||||||
}
|
}
|
||||||
|
|
||||||
const topic = this.get('topics').findProperty('id', parseInt(topicId));
|
const topic = this.get('topics').findBy('id', parseInt(topicId));
|
||||||
this.sendAction('postsAction', {topic, position: target.offset()});
|
this.sendAction('postsAction', {topic, position: target.offset()});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -50,7 +50,7 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
const posts = topic.get('postStream.posts');
|
const posts = topic.get('postStream.posts');
|
||||||
if (posts && topicId === topic.get('id')) {
|
if (posts && topicId === topic.get('id')) {
|
||||||
const quotedPost = posts.findProperty("post_number", postNumber);
|
const quotedPost = posts.findBy("post_number", postNumber);
|
||||||
if (quotedPost) {
|
if (quotedPost) {
|
||||||
return tinyAvatar(quotedPost.get('avatar_template'));
|
return tinyAvatar(quotedPost.get('avatar_template'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ class Toolbar {
|
||||||
}
|
}
|
||||||
|
|
||||||
addButton(button) {
|
addButton(button) {
|
||||||
const g = this.groups.findProperty('group', button.group);
|
const g = this.groups.findBy('group', button.group);
|
||||||
if (!g) {
|
if (!g) {
|
||||||
throw `Couldn't find toolbar group ${button.group}`;
|
throw `Couldn't find toolbar group ${button.group}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default Combobox.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
this.comboTemplate = (item) => {
|
this.comboTemplate = (item) => {
|
||||||
const contentItem = content.findProperty('id', item.id);
|
const contentItem = content.findBy('id', item.id);
|
||||||
if (!contentItem) { return item.text; }
|
if (!contentItem) { return item.text; }
|
||||||
return `${iconHTML(contentItem.icon)} ${item.text}`;
|
return `${iconHTML(contentItem.icon)} ${item.text}`;
|
||||||
};
|
};
|
||||||
|
|
|
@ -618,10 +618,10 @@ export default Ember.Controller.extend({
|
||||||
let category;
|
let category;
|
||||||
|
|
||||||
if (!splitCategory[1]) {
|
if (!splitCategory[1]) {
|
||||||
category = this.site.get('categories').findProperty('nameLower', splitCategory[0].toLowerCase());
|
category = this.site.get('categories').findBy('nameLower', splitCategory[0].toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
const categories = Discourse.Category.list();
|
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) {
|
category = categories.find(function(item) {
|
||||||
return item && item.get('nameLower') === splitCategory[1].toLowerCase() && item.get('parent_category_id') === mainCategory.id;
|
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
|
// Validate required fields
|
||||||
let userFields = this.get('userFields');
|
let userFields = this.get('userFields');
|
||||||
if (userFields) { userFields = userFields.filterProperty('field.required'); }
|
if (userFields) { userFields = userFields.filterBy('field.required'); }
|
||||||
if (!Ember.isEmpty(userFields)) {
|
if (!Ember.isEmpty(userFields)) {
|
||||||
const anyEmpty = userFields.any(function(uf) {
|
const anyEmpty = userFields.any(function(uf) {
|
||||||
const val = uf.get('value');
|
const val = uf.get('value');
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
let flagsAvailable = this.get('model.flagsAvailable');
|
let flagsAvailable = this.get('model.flagsAvailable');
|
||||||
|
|
||||||
// "message user" option should be at the top
|
// "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) {
|
if (notifyUserIndex !== -1) {
|
||||||
const notifyUser = flagsAvailable[notifyUserIndex];
|
const notifyUser = flagsAvailable[notifyUserIndex];
|
||||||
flagsAvailable.splice(notifyUserIndex, 1);
|
flagsAvailable.splice(notifyUserIndex, 1);
|
||||||
|
@ -93,7 +93,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
let postAction; // an instance of ActionSummary
|
let postAction; // an instance of ActionSummary
|
||||||
|
|
||||||
if (!this.get('flagTopic')) {
|
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 {
|
} else {
|
||||||
postAction = this.get('topicActionByName.' + this.get('selected.name_key'));
|
postAction = this.get('topicActionByName.' + this.get('selected.name_key'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
|
|
||||||
authMessage: (function() {
|
authMessage: (function() {
|
||||||
if (Ember.isEmpty(this.get('authenticate'))) return "";
|
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){
|
if(method){
|
||||||
return method.get('message');
|
return method.get('message');
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||||
|
|
||||||
// Staff can edit fields that are not `editable`
|
// Staff can edit fields that are not `editable`
|
||||||
if (!this.get('currentUser.staff')) {
|
if (!this.get('currentUser.staff')) {
|
||||||
siteUserFields = siteUserFields.filterProperty('editable', true);
|
siteUserFields = siteUserFields.filterBy('editable', true);
|
||||||
}
|
}
|
||||||
return siteUserFields.sortBy('position').map(function(field) {
|
return siteUserFields.sortBy('position').map(function(field) {
|
||||||
const value = userFields ? userFields[field.get('id').toString()] : null;
|
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');
|
const selectedReplies = this.get('selectedReplies');
|
||||||
selectedReplies.removeObject(post);
|
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); }
|
if (selectedReply) { selectedReplies.removeObject(selectedReply); }
|
||||||
|
|
||||||
this.set('allPostsSelected', false);
|
this.set('allPostsSelected', false);
|
||||||
|
@ -774,7 +774,7 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||||
postSelected(post) {
|
postSelected(post) {
|
||||||
if (this.get('allPostsSelected')) { return true; }
|
if (this.get('allPostsSelected')) { return true; }
|
||||||
if (this.get('selectedPosts').contains(post)) { 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;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default Ember.Controller.extend({
|
||||||
const siteUserFields = this.site.get('user_fields');
|
const siteUserFields = this.site.get('user_fields');
|
||||||
if (!Ember.isEmpty(siteUserFields)) {
|
if (!Ember.isEmpty(siteUserFields)) {
|
||||||
const userFields = this.get('user.user_fields');
|
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());
|
Ember.set(field, 'dasherized_name', field.get('name').dasherize());
|
||||||
const value = userFields ? userFields[field.get('id')] : null;
|
const value = userFields ? userFields[field.get('id')] : null;
|
||||||
return Ember.isEmpty(value) ? null : Ember.Object.create({ value, field });
|
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');
|
const siteUserFields = this.site.get('user_fields');
|
||||||
if (!Ember.isEmpty(siteUserFields)) {
|
if (!Ember.isEmpty(siteUserFields)) {
|
||||||
const userFields = this.get('model.user_fields');
|
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();
|
field.dasherized_name = field.get('name').dasherize();
|
||||||
const value = userFields ? userFields[field.get('id').toString()] : null;
|
const value = userFields ? userFields[field.get('id').toString()] : null;
|
||||||
return Ember.isEmpty(value) ? null : Ember.Object.create({ value, field });
|
return Ember.isEmpty(value) ? null : Ember.Object.create({ value, field });
|
||||||
|
|
|
@ -68,7 +68,7 @@ function initializeRecentlyUsedIcons() {
|
||||||
|
|
||||||
recent.forEach(emoji => recentlyUsedIcons.push(emoji.title));
|
recent.forEach(emoji => recentlyUsedIcons.push(emoji.title));
|
||||||
|
|
||||||
const recentGroup = groups.findProperty('name', 'recent');
|
const recentGroup = groups.findBy('name', 'recent');
|
||||||
if (recentGroup) {
|
if (recentGroup) {
|
||||||
recentGroup.icons = recentlyUsedIcons;
|
recentGroup.icons = recentlyUsedIcons;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,7 +37,7 @@ export function translateResults(results, opts) {
|
||||||
});
|
});
|
||||||
|
|
||||||
results.categories = results.categories.map(function(category){
|
results.categories = results.categories.map(function(category){
|
||||||
return Category.list().findProperty('id', category.id);
|
return Category.list().findBy('id', category.id);
|
||||||
}).compact();
|
}).compact();
|
||||||
|
|
||||||
const r = results.grouped_search_result;
|
const r = results.grouped_search_result;
|
||||||
|
|
|
@ -118,7 +118,7 @@ const Composer = RestModel.extend({
|
||||||
}.property().volatile(),
|
}.property().volatile(),
|
||||||
|
|
||||||
archetype: function() {
|
archetype: function() {
|
||||||
return this.get('archetypes').findProperty('id', this.get('archetypeId'));
|
return this.get('archetypes').findBy('id', this.get('archetypeId'));
|
||||||
}.property('archetypeId'),
|
}.property('archetypeId'),
|
||||||
|
|
||||||
archetypeChanged: function() {
|
archetypeChanged: function() {
|
||||||
|
@ -378,14 +378,14 @@ const Composer = RestModel.extend({
|
||||||
|
|
||||||
// If the user didn't change the template, clear it
|
// If the user didn't change the template, clear it
|
||||||
if (oldCategoryId) {
|
if (oldCategoryId) {
|
||||||
const oldCat = this.site.categories.findProperty('id', oldCategoryId);
|
const oldCat = this.site.categories.findBy('id', oldCategoryId);
|
||||||
if (oldCat && (oldCat.get('topic_template') === reply)) {
|
if (oldCat && (oldCat.get('topic_template') === reply)) {
|
||||||
reply = "";
|
reply = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Ember.isEmpty(reply)) { return; }
|
if (!Ember.isEmpty(reply)) { return; }
|
||||||
const category = this.site.categories.findProperty('id', categoryId);
|
const category = this.site.categories.findBy('id', categoryId);
|
||||||
if (category) {
|
if (category) {
|
||||||
this.set('reply', category.get('topic_template') || "");
|
this.set('reply', category.get('topic_template') || "");
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ const NavItem = Discourse.Model.extend({
|
||||||
categorySlug: function() {
|
categorySlug: function() {
|
||||||
var split = this.get('name').split('/');
|
var split = this.get('name').split('/');
|
||||||
if (split[0] === 'category' && split[1]) {
|
if (split[0] === 'category' && split[1]) {
|
||||||
var cat = Discourse.Site.current().categories.findProperty('nameLower', split[1].toLowerCase());
|
var cat = Discourse.Site.current().categories.findBy('nameLower', split[1].toLowerCase());
|
||||||
return cat ? Discourse.Category.slugFor(cat) : null;
|
return cat ? Discourse.Category.slugFor(cat) : null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -59,7 +59,7 @@ export default RestModel.extend({
|
||||||
@computed('hasLoadedData', 'firstPostId', 'posts.[]')
|
@computed('hasLoadedData', 'firstPostId', 'posts.[]')
|
||||||
firstPostPresent(hasLoadedData, firstPostId) {
|
firstPostPresent(hasLoadedData, firstPostId) {
|
||||||
if (!hasLoadedData) { return false; }
|
if (!hasLoadedData) { return false; }
|
||||||
return !!this.get('posts').findProperty('id', firstPostId);
|
return !!this.get('posts').findBy('id', firstPostId);
|
||||||
},
|
},
|
||||||
|
|
||||||
firstPostNotLoaded: Ember.computed.not('firstPostPresent'),
|
firstPostNotLoaded: Ember.computed.not('firstPostPresent'),
|
||||||
|
@ -71,7 +71,7 @@ export default RestModel.extend({
|
||||||
if (!hasLoadedData) { return false; }
|
if (!hasLoadedData) { return false; }
|
||||||
if (lastPostId === -1) { return true; }
|
if (lastPostId === -1) { return true; }
|
||||||
|
|
||||||
return !!this.get('posts').findProperty('id', lastPostId);
|
return !!this.get('posts').findBy('id', lastPostId);
|
||||||
},
|
},
|
||||||
|
|
||||||
lastPostNotLoaded: Ember.computed.not('loadedAllPosts'),
|
lastPostNotLoaded: Ember.computed.not('loadedAllPosts'),
|
||||||
|
@ -208,7 +208,7 @@ export default RestModel.extend({
|
||||||
if (opts.forceLoad) {
|
if (opts.forceLoad) {
|
||||||
this.set('loaded', false);
|
this.set('loaded', false);
|
||||||
} else {
|
} else {
|
||||||
const postWeWant = this.get('posts').findProperty('post_number', opts.nearPost);
|
const postWeWant = this.get('posts').findBy('post_number', opts.nearPost);
|
||||||
if (postWeWant) { return Ember.RSVP.resolve(); }
|
if (postWeWant) { return Ember.RSVP.resolve(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ const Post = RestModel.extend({
|
||||||
|
|
||||||
internalLinks: function() {
|
internalLinks: function() {
|
||||||
if (Ember.isEmpty(this.get('link_counts'))) return null;
|
if (Ember.isEmpty(this.get('link_counts'))) return null;
|
||||||
return this.get('link_counts').filterProperty('internal').filterProperty('title');
|
return this.get('link_counts').filterBy('internal').filterBy('title');
|
||||||
}.property('link_counts.@each.internal'),
|
}.property('link_counts.@each.internal'),
|
||||||
|
|
||||||
flagsAvailable: function() {
|
flagsAvailable: function() {
|
||||||
|
|
|
@ -20,7 +20,7 @@ const Site = RestModel.extend({
|
||||||
flagTypes() {
|
flagTypes() {
|
||||||
const postActionTypes = this.get('post_action_types');
|
const postActionTypes = this.get('post_action_types');
|
||||||
if (!postActionTypes) return [];
|
if (!postActionTypes) return [];
|
||||||
return postActionTypes.filterProperty('is_flag', true);
|
return postActionTypes.filterBy('is_flag', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
topicCountDesc: ['topic_count:desc'],
|
topicCountDesc: ['topic_count:desc'],
|
||||||
|
@ -64,7 +64,7 @@ const Site = RestModel.extend({
|
||||||
|
|
||||||
removeCategory(id) {
|
removeCategory(id) {
|
||||||
const categories = this.get('categories');
|
const categories = this.get('categories');
|
||||||
const existingCategory = categories.findProperty('id', id);
|
const existingCategory = categories.findBy('id', id);
|
||||||
if (existingCategory) {
|
if (existingCategory) {
|
||||||
categories.removeObject(existingCategory);
|
categories.removeObject(existingCategory);
|
||||||
delete this.get('categoriesById').categoryId;
|
delete this.get('categoriesById').categoryId;
|
||||||
|
@ -74,7 +74,7 @@ const Site = RestModel.extend({
|
||||||
updateCategory(newCategory) {
|
updateCategory(newCategory) {
|
||||||
const categories = this.get('categories');
|
const categories = this.get('categories');
|
||||||
const categoryId = Em.get(newCategory, 'id');
|
const categoryId = Em.get(newCategory, 'id');
|
||||||
const existingCategory = categories.findProperty('id', categoryId);
|
const existingCategory = categories.findBy('id', categoryId);
|
||||||
|
|
||||||
// Don't update null permissions
|
// Don't update null permissions
|
||||||
if (newCategory.permission === null) { delete newCategory.permission; }
|
if (newCategory.permission === null) { delete newCategory.permission; }
|
||||||
|
|
|
@ -72,7 +72,7 @@ const TopicDetails = RestModel.extend({
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: { name: name }
|
data: { name: name }
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
groups.removeObject(groups.findProperty('name', name));
|
groups.removeObject(groups.findBy('name', name));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ const TopicDetails = RestModel.extend({
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: { username: username }
|
data: { username: username }
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
users.removeObject(users.findProperty('username', username));
|
users.removeObject(users.findBy('username', username));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -120,7 +120,7 @@ const Topic = RestModel.extend({
|
||||||
const categoryName = this.get('categoryName');
|
const categoryName = this.get('categoryName');
|
||||||
let category;
|
let category;
|
||||||
if (categoryName) {
|
if (categoryName) {
|
||||||
category = Discourse.Category.list().findProperty('name', categoryName);
|
category = Discourse.Category.list().findBy('name', categoryName);
|
||||||
}
|
}
|
||||||
this.set('category', category);
|
this.set('category', category);
|
||||||
}.observes('categoryName'),
|
}.observes('categoryName'),
|
||||||
|
@ -213,7 +213,7 @@ const Topic = RestModel.extend({
|
||||||
}.property('views'),
|
}.property('views'),
|
||||||
|
|
||||||
archetypeObject: function() {
|
archetypeObject: function() {
|
||||||
return Discourse.Site.currentProp('archetypes').findProperty('id', this.get('archetype'));
|
return Discourse.Site.currentProp('archetypes').findBy('id', this.get('archetype'));
|
||||||
}.property('archetype'),
|
}.property('archetype'),
|
||||||
|
|
||||||
isPrivateMessage: Em.computed.equal('archetype', 'private_message'),
|
isPrivateMessage: Em.computed.equal('archetype', 'private_message'),
|
||||||
|
|
|
@ -153,7 +153,7 @@ const User = RestModel.extend({
|
||||||
|
|
||||||
@computed("trust_level")
|
@computed("trust_level")
|
||||||
trustLevel(trustLevel) {
|
trustLevel(trustLevel) {
|
||||||
return Discourse.Site.currentProp('trustLevels').findProperty('id', parseInt(trustLevel, 10));
|
return Discourse.Site.currentProp('trustLevels').findBy('id', parseInt(trustLevel, 10));
|
||||||
},
|
},
|
||||||
|
|
||||||
isBasic: Em.computed.equal('trust_level', 0),
|
isBasic: Em.computed.equal('trust_level', 0),
|
||||||
|
@ -525,7 +525,7 @@ User.reopenClass(Singleton, {
|
||||||
action_type: UserAction.TYPES.replies
|
action_type: UserAction.TYPES.replies
|
||||||
});
|
});
|
||||||
|
|
||||||
stats.filterProperty('isResponse').forEach(stat => {
|
stats.filterBy('isResponse').forEach(stat => {
|
||||||
responses.set('count', responses.get('count') + stat.get('count'));
|
responses.set('count', responses.get('count') + stat.get('count'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -463,11 +463,11 @@ export default createWidget('post', {
|
||||||
|
|
||||||
undoPostAction(typeId) {
|
undoPostAction(typeId) {
|
||||||
const post = this.model;
|
const post = this.model;
|
||||||
return post.get('actions_summary').findProperty('id', typeId).undo(post);
|
return post.get('actions_summary').findBy('id', typeId).undo(post);
|
||||||
},
|
},
|
||||||
|
|
||||||
deferPostActionFlags(typeId) {
|
deferPostActionFlags(typeId) {
|
||||||
const post = this.model;
|
const post = this.model;
|
||||||
return post.get('actions_summary').findProperty('id', typeId).deferFlags(post);
|
return post.get('actions_summary').findBy('id', typeId).deferFlags(post);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
@computed('user.role')
|
@computed('user.role')
|
||||||
roleName(role) {
|
roleName(role) {
|
||||||
return this.get('roles').findProperty('id', role).label;
|
return this.get('roles').findBy('id', role).label;
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default Ember.Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
const users = this.get('users');
|
const users = this.get('users');
|
||||||
if (users.findProperty('email', user.email)) {
|
if (users.findBy('email', user.email)) {
|
||||||
return this.set('invalid', true);
|
return this.set('invalid', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ export default Ember.Object.extend(ValidState, {
|
||||||
},
|
},
|
||||||
|
|
||||||
fieldError(id, description) {
|
fieldError(id, description) {
|
||||||
const field = this.get('fields').findProperty('id', id);
|
const field = this.get('fields').findBy('id', id);
|
||||||
if (field) {
|
if (field) {
|
||||||
field.setValid(false, description);
|
field.setValid(false, description);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@ const Wizard = Ember.Object.extend({
|
||||||
totalSteps: length => length,
|
totalSteps: length => length,
|
||||||
|
|
||||||
getTitle() {
|
getTitle() {
|
||||||
const titleStep = this.get('steps').findProperty('id', 'forum-title');
|
const titleStep = this.get('steps').findBy('id', 'forum-title');
|
||||||
if (!titleStep) { return; }
|
if (!titleStep) { return; }
|
||||||
return titleStep.get('fieldsById.title.value');
|
return titleStep.get('fieldsById.title.value');
|
||||||
},
|
},
|
||||||
|
|
||||||
getLogoUrl() {
|
getLogoUrl() {
|
||||||
const logoStep = this.get('steps').findProperty('id', 'logos');
|
const logoStep = this.get('steps').findBy('id', 'logos');
|
||||||
if (!logoStep) { return; }
|
if (!logoStep) { return; }
|
||||||
return logoStep.get('fieldsById.logo_url.value');
|
return logoStep.get('fieldsById.logo_url.value');
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ const Wizard = Ember.Object.extend({
|
||||||
|
|
||||||
// A bit clunky, but get the current colors from the appropriate step
|
// A bit clunky, but get the current colors from the appropriate step
|
||||||
getCurrentColors() {
|
getCurrentColors() {
|
||||||
const colorStep = this.get('steps').findProperty('id', 'colors');
|
const colorStep = this.get('steps').findBy('id', 'colors');
|
||||||
if (!colorStep) { return; }
|
if (!colorStep) { return; }
|
||||||
|
|
||||||
const themeChoice = colorStep.get('fieldsById.theme_id');
|
const themeChoice = colorStep.get('fieldsById.theme_id');
|
||||||
|
@ -34,7 +34,7 @@ const Wizard = Ember.Object.extend({
|
||||||
const choices = themeChoice.get('choices');
|
const choices = themeChoice.get('choices');
|
||||||
if (!choices) { return; }
|
if (!choices) { return; }
|
||||||
|
|
||||||
const option = choices.findProperty('id', themeId);
|
const option = choices.findBy('id', themeId);
|
||||||
if (!option) { return; }
|
if (!option) { return; }
|
||||||
|
|
||||||
return option.data.colors;
|
return option.data.colors;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export default Ember.Route.extend({
|
export default Ember.Route.extend({
|
||||||
model(params) {
|
model(params) {
|
||||||
const allSteps = this.modelFor('application').steps;
|
const allSteps = this.modelFor('application').steps;
|
||||||
const step = allSteps.findProperty('id', params.step_id);
|
const step = allSteps.findBy('id', params.step_id);
|
||||||
return step ? step : allSteps[0];
|
return step ? step : allSteps[0];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue