Add ability to set topic by double-clicking on the topic text then hitting enter.

This commit is contained in:
Kegan Dougal 2014-09-08 18:40:34 -07:00
parent f64cc237fc
commit 6bdb23449a
5 changed files with 59 additions and 1 deletions

View file

@ -149,6 +149,7 @@ angular.module('eventHandlerService', [])
$rootScope.$broadcast(NAME_EVENT, event, isLiveEvent);
};
// TODO: Can this just be a generic "I am a room state event, can haz store?"
var handleRoomTopic = function(event, isLiveEvent) {
console.log("handleRoomTopic live="+isLiveEvent);

View file

@ -235,6 +235,25 @@ angular.module('matrixService', [])
return doRequest("GET", path, undefined, {});
},
setTopic: function(room_id, topic) {
var data = {
topic: topic
};
return this.sendStateEvent(room_id, "m.room.topic", data);
},
sendStateEvent: function(room_id, eventType, content, state_key) {
var path = "/rooms/$room_id/state/"+eventType;
if (state_key !== undefined) {
path += "/" + state_key;
}
room_id = encodeURIComponent(room_id);
path = path.replace("$room_id", room_id);
return doRequest("PUT", path, undefined, content);
},
sendEvent: function(room_id, eventType, txn_id, content) {
// The REST path spec