{"action":"created","comment":{"url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/comments/53003159","id":53003159,"diff_hunk":"@@ -189,5 +189,28 @@ module.exports.MatrixEvent.prototype = {\n \n     getUnsigned: function() {\n         return this.event.unsigned || {};\n-    }\n+    },\n+\n+    /**\n+     * Update the content of an event in the same way it would be by the server\n+     * if it were redacted before it was sent to us\n+     *\n+     * @param {Object} the raw event causing the redaction\n+     */\n+    makeRedacted: function(redaction_event) {\n+        if (!this.event.unsigned) {\n+            this.event.unsigned = {};\n+        }\n+        this.event.unsigned.redacted_because = redaction_event;\n+        this.event.content = {};","path":"lib/models/event.js","position":18,"original_position":18,"commit_id":"5eff2784544b8829a102fddd19998380a0f8b901","original_commit_id":"5eff2784544b8829a102fddd19998380a0f8b901","user":{"login":"ara4n","id":1294269,"avatar_url":"https://avatars.githubusercontent.com/u/1294269?v=3","gravatar_id":"","url":"https://api.github.com/users/ara4n","html_url":"https://github.com/ara4n","followers_url":"https://api.github.com/users/ara4n/followers","following_url":"https://api.github.com/users/ara4n/following{/other_user}","gists_url":"https://api.github.com/users/ara4n/gists{/gist_id}","starred_url":"https://api.github.com/users/ara4n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ara4n/subscriptions","organizations_url":"https://api.github.com/users/ara4n/orgs","repos_url":"https://api.github.com/users/ara4n/repos","events_url":"https://api.github.com/users/ara4n/events{/privacy}","received_events_url":"https://api.github.com/users/ara4n/received_events","type":"User","site_admin":false},"body":"Is this sufficient?  http://matrix.org/docs/spec/r0.0.1/client_server.html#redactions says: \r\n\r\nUpon receipt of a redaction event, the server should strip off any keys **not** in the following list:\r\n * event_id\r\n * type\r\n * room_id\r\n * user_id\r\n * state_key\r\n * prev_state\r\n * content\r\n\r\nThe content object should also be stripped of all keys, unless it is one of one of the following event types:\r\n\r\n * m.room.member allows key membership\r\n * m.room.create allows key creator\r\n * m.room.join_rules allows key join_rule\r\n * m.room.power_levels allows keys ban, events, events_default, kick, redact, state_default, users, users_default.\r\n * m.room.aliases allows key aliases\r\n\r\nI have used redactions quite a few times on things like membership change events in order to redact offensive displaynames - is this going to be sufficient?","created_at":"2016-02-16T12:20:08Z","updated_at":"2016-02-16T12:20:08Z","html_url":"https://github.com/matrix-org/matrix-js-sdk/pull/80#discussion_r53003159","pull_request_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/80","_links":{"self":{"href":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/comments/53003159"},"html":{"href":"https://github.com/matrix-org/matrix-js-sdk/pull/80#discussion_r53003159"},"pull_request":{"href":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/80"}}},"pull_request":{"url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/80","id":59481418,"html_url":"https://github.com/matrix-org/matrix-js-sdk/pull/80","diff_url":"https://github.com/matrix-org/matrix-js-sdk/pull/80.diff","patch_url":"https://github.com/matrix-org/matrix-js-sdk/pull/80.patch","issue_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/issues/80","number":80,"state":"open","locked":false,"title":"Keep redacted events in the timeline","user":{"login":"richvdh","id":1389908,"avatar_url":"https://avatars.githubusercontent.com/u/1389908?v=3","gravatar_id":"","url":"https://api.github.com/users/richvdh","html_url":"https://github.com/richvdh","followers_url":"https://api.github.com/users/richvdh/followers","following_url":"https://api.github.com/users/richvdh/following{/other_user}","gists_url":"https://api.github.com/users/richvdh/gists{/gist_id}","starred_url":"https://api.github.com/users/richvdh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richvdh/subscriptions","organizations_url":"https://api.github.com/users/richvdh/orgs","repos_url":"https://api.github.com/users/richvdh/repos","events_url":"https://api.github.com/users/richvdh/events{/privacy}","received_events_url":"https://api.github.com/users/richvdh/received_events","type":"User","site_admin":false},"body":"Everything gets confused when we remove events from timelines, so keep\nredacted events in there, and mark them as redacted instead.","created_at":"2016-02-16T12:06:11Z","updated_at":"2016-02-16T12:20:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42f5c538d79c89914df20fad0278ac1994df60c4","assignee":{"login":"ara4n","id":1294269,"avatar_url":"https://avatars.githubusercontent.com/u/1294269?v=3","gravatar_id":"","url":"https://api.github.com/users/ara4n","html_url":"https://github.com/ara4n","followers_url":"https://api.github.com/users/ara4n/followers","following_url":"https://api.github.com/users/ara4n/following{/other_user}","gists_url":"https://api.github.com/users/ara4n/gists{/gist_id}","starred_url":"https://api.github.com/users/ara4n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ara4n/subscriptions","organizations_url":"https://api.github.com/users/ara4n/orgs","repos_url":"https://api.github.com/users/ara4n/repos","events_url":"https://api.github.com/users/ara4n/events{/privacy}","received_events_url":"https://api.github.com/users/ara4n/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/80/commits","review_comments_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/80/comments","review_comment_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/issues/80/comments","statuses_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/statuses/5eff2784544b8829a102fddd19998380a0f8b901","head":{"label":"matrix-org:rav/keep_redactions","ref":"rav/keep_redactions","sha":"5eff2784544b8829a102fddd19998380a0f8b901","user":{"login":"matrix-org","id":8418310,"avatar_url":"https://avatars.githubusercontent.com/u/8418310?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"repo":{"id":31670053,"name":"matrix-js-sdk","full_name":"matrix-org/matrix-js-sdk","owner":{"login":"matrix-org","id":8418310,"avatar_url":"https://avatars.githubusercontent.com/u/8418310?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/matrix-org/matrix-js-sdk","description":"Matrix Client-Server SDK for JavaScript","fork":false,"url":"https://api.github.com/repos/matrix-org/matrix-js-sdk","forks_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/forks","keys_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/teams","hooks_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/hooks","issue_events_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/events","assignees_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/tags","blobs_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/languages","stargazers_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/stargazers","contributors_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/contributors","subscribers_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/subscribers","subscription_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/subscription","commits_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/merges","archive_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/downloads","issues_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/labels{/name}","releases_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/deployments","created_at":"2015-03-04T17:28:51Z","updated_at":"2016-02-16T07:44:23Z","pushed_at":"2016-02-16T12:06:12Z","git_url":"git://github.com/matrix-org/matrix-js-sdk.git","ssh_url":"git@github.com:matrix-org/matrix-js-sdk.git","clone_url":"https://github.com/matrix-org/matrix-js-sdk.git","svn_url":"https://github.com/matrix-org/matrix-js-sdk","homepage":"","size":2240,"stargazers_count":23,"watchers_count":23,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":5,"forks":7,"open_issues":5,"watchers":23,"default_branch":"master"}},"base":{"label":"matrix-org:develop","ref":"develop","sha":"c8d1e210a371e2dafd9997f3990cbbd2bcff2b7a","user":{"login":"matrix-org","id":8418310,"avatar_url":"https://avatars.githubusercontent.com/u/8418310?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"repo":{"id":31670053,"name":"matrix-js-sdk","full_name":"matrix-org/matrix-js-sdk","owner":{"login":"matrix-org","id":8418310,"avatar_url":"https://avatars.githubusercontent.com/u/8418310?v=3","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/matrix-org/matrix-js-sdk","description":"Matrix Client-Server SDK for JavaScript","fork":false,"url":"https://api.github.com/repos/matrix-org/matrix-js-sdk","forks_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/forks","keys_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/teams","hooks_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/hooks","issue_events_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/events","assignees_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/tags","blobs_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/languages","stargazers_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/stargazers","contributors_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/contributors","subscribers_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/subscribers","subscription_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/subscription","commits_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/merges","archive_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/downloads","issues_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/labels{/name}","releases_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/matrix-org/matrix-js-sdk/deployments","created_at":"2015-03-04T17:28:51Z","updated_at":"2016-02-16T07:44:23Z","pushed_at":"2016-02-16T12:06:12Z","git_url":"git://github.com/matrix-org/matrix-js-sdk.git","ssh_url":"git@github.com:matrix-org/matrix-js-sdk.git","clone_url":"https://github.com/matrix-org/matrix-js-sdk.git","svn_url":"https://github.com/matrix-org/matrix-js-sdk","homepage":"","size":2240,"stargazers_count":23,"watchers_count":23,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":5,"forks":7,"open_issues":5,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/80"},"html":{"href":"https://github.com/matrix-org/matrix-js-sdk/pull/80"},"issue":{"href":"https://api.github.com/repos/matrix-org/matrix-js-sdk/issues/80"},"comments":{"href":"https://api.github.com/repos/matrix-org/matrix-js-sdk/issues/80/comments"},"review_comments":{"href":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/80/comments"},"review_comment":{"href":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/matrix-org/matrix-js-sdk/pulls/80/commits"},"statuses":{"href":"https://api.github.com/repos/matrix-org/matrix-js-sdk/statuses/5eff2784544b8829a102fddd19998380a0f8b901"}}}}