more group progress, UI getting there, controller mostly done

changed it so notify moderators goes to the moderators group
allow admins to grant self moderation and revoke self moderation
This commit is contained in:
Sam
2013-05-09 17:37:34 +10:00
parent 4f328e3e45
commit 5280b3a01b
27 changed files with 224 additions and 61 deletions

View File

@ -56,20 +56,23 @@ limit 100
map[p["id"]] = p
}
sql = SqlBuilder.new "select a.id, a.user_id, post_action_type_id, a.created_at, post_id, a.message
sql = SqlBuilder.new "select a.id, a.user_id, post_action_type_id, a.created_at, post_id, a.message, p.topic_id, t.slug
from post_actions a
left join posts p on p.id = related_post_id
left join topics t on t.id = p.topic_id
/*where*/
"
sql.where("post_action_type_id in (:flag_types)", flag_types: PostActionType.notify_flag_types.values)
sql.where("post_id in (:posts)", posts: posts.map{|p| p["id"].to_i})
if params[:filter] == 'old'
sql.where('deleted_at is not null')
sql.where('a.deleted_at is not null')
else
sql.where('deleted_at is null')
sql.where('a.deleted_at is null')
end
sql.exec.each do |action|
action["permalink"] = Topic.url(action["topic_id"],action["slug"]) if action["slug"].present?
p = map[action["post_id"]]
p[:post_actions] ||= []
p[:post_actions] << action

View File

@ -1,7 +1,7 @@
class Admin::GroupsController < Admin::AdminController
def index
groups = Group.order(:name).all
render_serialized(groups, AdminGroupSerializer)
render_serialized(groups, BasicGroupSerializer)
end
def refresh_automatic_groups
@ -11,7 +11,7 @@ class Admin::GroupsController < Admin::AdminController
def users
group = Group.find(params[:group_id].to_i)
render_serialized(group.users, BasicUserSerializer)
render_serialized(group.users.limit(100).to_a, BasicUserSerializer)
end
def update
@ -28,7 +28,7 @@ class Admin::GroupsController < Admin::AdminController
group.name = params[:group][:name]
group.usernames = params[:group][:usernames] if params[:group][:usernames]
group.save!
render_serialized(group, AdminGroupSerializer)
render_serialized(group, BasicGroupSerializer)
end
def destroy