metamaps--metamaps/app/models/webhooks/slack/base.rb
Connor Turland fb12c7e202 Track everything we need to reconstruct maps (#984)
* feature/more.events

* keep mapping.user as the creator

* cleanup cruft and include slack notifs

* capture topic and synapse updates, store the old values

* avoid the mapping gets deleted problem

* include an indicator of which values changed

* style cleanup

* remove the hack in favor of a legit way

* updated schema file
2016-12-16 16:51:52 -05:00

35 lines
597 B
Ruby

# frozen_string_literal: true
Webhooks::Slack::Base = Struct.new(:webhook, :event) do
include Routing
def username
'Metamaps Bot'
end
def icon_url
'https://pbs.twimg.com/profile_images/539300245029392385/dJ1bwnw7.jpeg'
end
def text
'something'
end
delegate :channel, to: :webhook
alias_method :read_attribute_for_serialization, :send
private
def view_map_on_metamaps(text = nil)
"<#{map_url(event.map)}|#{text || event.map.name}>"
end
def eventable
@eventable ||= event.eventable
end
def author
@author ||= eventable.author
end
end