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
21
# 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] )
    convo.remove_tag( WpTag::INBOX ) if params[:is_move]
  end
  flash[:notice] = "outcome: #{outs}"
  render json: { status: :ok }
end

#deleteObject



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

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



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

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