 	edit: (element, index) ->
 		index = this.getEditingIndex(element) if not index?
 
-		message = this.getMessageOfElement(element)
+		message = this.getMessageById element.getAttribute("id")
+
 		hasPermission = RocketChat.authz.hasAtLeastOnePermission('edit-message', message.rid)
 		editAllowed = RocketChat.settings.get 'Message_AllowEditing'
 		editOwn = message?.u?._id is Meteor.userId()

		this.clearMessageDraft this.editing.id

	resetToDraft: (id) ->
		this.input.value = this.records[id].original


	getMessageOfElement: (element) -> return ChatMessage.findOne( { _id: element.getAttribute("id") } )


	toPrevMessage: ->
		index = this.editing.index


		msg = this.getMessageDraft(message._id)?.draft
		msg = message.msg unless msg?

		editingNext = this.editing.index < index

