Class: Ishapi::EmailConversationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ishapi/email_conversations_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#exception, #home, #long_term_token, #vote

Instance Method Details

#addtagObject



12
13
14
15
16
17
18
19
20
# File 'app/controllers/ishapi/email_conversations_controller.rb', line 12

def addtag
  authorize! :email_conversations_addtag, ::Ishapi
  convos = Office::EmailConversation.find params[:ids]
  outs = convos.map do |convo|
    convo.add_tag( params[:emailtag] )
  end
  flash[:notice] = "outcome: #{outs}"
  render json: { status: :ok }
end

#deleteObject



32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/ishapi/email_conversations_controller.rb', line 32

def delete
  authorize! :email_conversations_delete, ::Ishapi
  convos = Office::EmailConversation.find params[:ids]
  outs = convos.map do |convo|
    convo.add_tag( WpTag::TRASH )
    convo.remove_tag( WpTag::INBOX )
  end
  flash[:notice] = "outcome: #{outs}"
  render json: { status: :ok }
end

#rmtagObject



22
23
24
25
26
27
28
29
30
# File 'app/controllers/ishapi/email_conversations_controller.rb', line 22

def rmtag
  authorize! :email_conversations_addtag, ::Ishapi
  convos = Office::EmailConversation.find params[:ids]
  outs = convos.map do |convo|
    convo.remove_tag( params[:emailtag] )
  end
  flash[:notice] = "outcome: #{outs}"
  render json: { status: :ok }
end