Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
canvas
/
app
/
graphql
/
mutations
/
Filename :
subscribe_to_discussion_topic.rb
back
Copy
# frozen_string_literal: true # # Copyright (C) 2021 - present Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # class Mutations::SubscribeToDiscussionTopic < Mutations::BaseMutation graphql_name "SubscribeToDiscussionTopic" argument :discussion_topic_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionTopic") argument :subscribed, Boolean, required: true field :discussion_topic, Types::DiscussionType, null: false def resolve(input:) discussion_topic = DiscussionTopic.find(input[:discussion_topic_id]) discussion_topic.change_subscribed_state(input[:subscribed], current_user) { discussion_topic: } rescue ActiveRecord::RecordNotFound raise GraphQL::ExecutionError, "not found" end end