mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 07:01:13 +08:00
Apply comments from eviltrout, using this.get('category.id'), and use snake case for category_id
This commit is contained in:
@ -85,8 +85,7 @@ var controllerOpts = {
|
|||||||
if (selected.length > 0) {
|
if (selected.length > 0) {
|
||||||
promise = Discourse.Topic.bulkOperation(selected, operation);
|
promise = Discourse.Topic.bulkOperation(selected, operation);
|
||||||
} else {
|
} else {
|
||||||
var category = this.get('category');
|
promise = Discourse.Topic.bulkOperationByFilter('unread', operation, this.get('category.id'));
|
||||||
promise = Discourse.Topic.bulkOperationByFilter('unread', operation, category ? category.id : null);
|
|
||||||
}
|
}
|
||||||
promise.then(function(result) {
|
promise.then(function(result) {
|
||||||
if (result && result.topic_ids) {
|
if (result && result.topic_ids) {
|
||||||
|
@ -454,7 +454,7 @@ Discourse.Topic.reopenClass({
|
|||||||
|
|
||||||
bulkOperationByFilter: function(filter, operation, categoryId) {
|
bulkOperationByFilter: function(filter, operation, categoryId) {
|
||||||
var data = { filter: filter, operation: operation };
|
var data = { filter: filter, operation: operation };
|
||||||
if (categoryId) data['categoryId'] = categoryId;
|
if (categoryId) data['category_id'] = categoryId;
|
||||||
return Discourse.ajax("/topics/bulk", {
|
return Discourse.ajax("/topics/bulk", {
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
data: data
|
data: data
|
||||||
|
@ -359,8 +359,8 @@ class TopicsController < ApplicationController
|
|||||||
topic_ids = params[:topic_ids].map {|t| t.to_i}
|
topic_ids = params[:topic_ids].map {|t| t.to_i}
|
||||||
elsif params[:filter] == 'unread'
|
elsif params[:filter] == 'unread'
|
||||||
tq = TopicQuery.new(current_user)
|
tq = TopicQuery.new(current_user)
|
||||||
if params[:categoryId]
|
if params[:category_id]
|
||||||
topic_ids = TopicQuery.unread_filter(tq.joined_topic_user).listable_topics.where('category_id = ?', params[:categoryId]).pluck(:id)
|
topic_ids = TopicQuery.unread_filter(tq.joined_topic_user).listable_topics.where('category_id = ?', params[:category_id]).pluck(:id)
|
||||||
else
|
else
|
||||||
topic_ids = TopicQuery.unread_filter(tq.joined_topic_user).listable_topics.pluck(:id)
|
topic_ids = TopicQuery.unread_filter(tq.joined_topic_user).listable_topics.pluck(:id)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user