Class: Decidim::UserGroupJoinRequestsController
- Inherits:
-
ApplicationController
- Object
- DecidimController
- ApplicationController
- Decidim::UserGroupJoinRequestsController
- Includes:
- FormFactory, UserGroups
- Defined in:
- app/controllers/decidim/user_group_join_requests_controller.rb
Overview
The controller to handle user groups join requests.
Instance Method Summary collapse
Methods included from UserGroups
Methods included from UserBlockedChecker
#check_user_block_status, #check_user_not_blocked
Methods included from NeedsSnippets
Methods included from Headers::HttpCachingDisabler
Methods included from HasStoredPath
#skip_store_location?, #store_current_location
Methods included from TranslatableAttributes
Methods included from RegistersPermissions
Methods included from NeedsOrganization
enhance_controller, extended, included
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/decidim/user_group_join_requests_controller.rb', line 11 def create :join, :user_group JoinUserGroup.call(current_user, user_group) do on(:ok) do flash[:notice] = t("groups.join.success", scope: "decidim") redirect_back fallback_location: profile_members_path(user_group.nickname) end on(:invalid) do flash[:alert] = t("groups.join.error", scope: "decidim") redirect_back fallback_location: profile_members_path(user_group.nickname) end end end |
#destroy ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/controllers/decidim/user_group_join_requests_controller.rb', line 45 def destroy (:manage, :user_group, user_group:) RejectUserGroupJoinRequest.call(membership) do on(:ok) do flash[:notice] = t("group_members.reject.success", scope: "decidim") redirect_back fallback_location: profile_group_members_path(user_group.nickname) end on(:invalid) do flash[:alert] = t("group_members.reject.error", scope: "decidim") redirect_back fallback_location: profile_group_members_path(user_group.nickname) end end end |
#update ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/decidim/user_group_join_requests_controller.rb', line 28 def update (:manage, :user_group, user_group:) AcceptUserGroupJoinRequest.call(membership) do on(:ok) do flash[:notice] = t("group_members.accept.success", scope: "decidim") redirect_back fallback_location: profile_group_members_path(user_group.nickname) end on(:invalid) do flash[:alert] = t("group_members.accept.error", scope: "decidim") redirect_back fallback_location: profile_group_members_path(user_group.nickname) end end end |