Commit Graph

3450 Commits (fe56138142f386c927e0221414f223428d7c000d)

Author SHA1 Message Date
Mark Haines 1ee7280c4c Do the /sync in parallel accross the rooms like /initialSync does 2015-12-11 16:48:20 +00:00
Erik Johnston cde49d3d2b Merge pull request #435 from matrix-org/erikj/search
Include approximate count of search results
2015-12-11 16:27:38 +00:00
Erik Johnston d9a5c56930 Include approximate count of search results 2015-12-11 11:40:23 +00:00
Erik Johnston 51fb590c0e Use more efficient query form 2015-12-11 11:12:57 +00:00
David Baker 5e909c73d7 Store nothing instead of ['dont_notify'] for events with no notification required: much as it would be nice to be able to tell between the event not having been processed and there being no notification for it, this isn't worth filling up the table with ['dont_notify'] I think. Consequently treat the empty actions array as dont_notify and filter dont_notify out of the result. 2015-12-10 18:40:28 +00:00
Mark Haines 515548a47a Missing yield 2015-12-10 17:54:23 +00:00
David Baker aa667ee396 Save event actions to the db 2015-12-10 17:51:15 +00:00
Mark Haines 7d6b313312 Add caches for whether a room has been forgotten by a user 2015-12-10 17:49:34 +00:00
David Baker a84a693327 Having consulted The Erikle, this should go at the end of on_receive_pdu, otherwise it will be triggered whenever we backfill too. 2015-12-10 17:18:46 +00:00
Paul "LeoNerd" Evans 99afb4b750 Ensure that the event that gets persisted is the one that was signed 2015-12-10 17:08:21 +00:00
David Baker 21f135ba76 Very first cut of calculating actions for events as they come in. Doesn't store them yet. Not very efficient. 2015-12-10 16:26:08 +00:00
Mark Haines a8589d1ff3 Mark the version as a -rc1 release candidate 2015-12-10 11:39:00 +00:00
Mark Haines 05f6cb42db Bump synapse version to v0.12.0 2015-12-09 17:48:02 +00:00
David Baker a24eedada7 pep8 2015-12-09 15:57:42 +00:00
David Baker 4a728beba1 Split out the push rule evaluator into a separate file so it can be more readily reused. Should be functionally identical. 2015-12-09 15:51:34 +00:00
Mark Haines e4bfe50e8f Allow filter JSON object in the filter query parameter in /sync
Documented by matrix-org/matrix-doc#224
2015-12-09 12:56:50 +00:00
Daniel Wagner-Hall 0f826b0b0d Merge pull request #430 from matrix-org/daniel/unstable
Merge pull request #430 from matrix-org/daniel/unstable
2015-12-09 11:34:22 +00:00
Erik Johnston 7c2ff8c889 Merge pull request #405 from matrix-org/erikj/search-ts
Change the result dict to be a list in /search response
2015-12-08 16:15:27 +00:00
Daniel Wagner-Hall 7a8ba4c9a0 Actually host r0 and unstable prefixes 2015-12-08 15:26:52 +00:00
Mark Haines 6a5ff5f223 Track the time spent in the database per request.
and track the number of transactions that request started.
2015-12-07 17:56:11 +00:00
Mark Haines f7a1cdbbc6 Merge pull request #423 from matrix-org/markjh/archived_flag
Only include the archived rooms if a include_leave flag in set in the…
2015-12-07 13:16:03 +00:00
Mark Haines d547afeae0 Merge remote-tracking branch 'origin/master' into develop 2015-12-07 13:13:43 +00:00
David Baker 9c9b2829ae also do more structured logging 2015-12-07 12:01:00 +00:00
David Baker 50e5886de1 pep8 2015-12-07 11:57:48 +00:00
David Baker ba1d740239 Add logging to pushers API to log the body of the request 2015-12-07 11:52:20 +00:00
Mark Haines a190b2e85e Merge pull request #427 from matrix-org/markjh/log_context
Add a setter for the current log context.
2015-12-07 11:00:12 +00:00
Mark Haines 3dd1630848 Add a setter for the current log context.
Move the resource tracking inside that setter so that it is easier
to make sure that the resource tracking isn't double counting the
resource usage.
2015-12-07 10:51:18 +00:00
Daniel Wagner-Hall 41905784f7 Take object not bool
Allows bool as legacy fallback

See https://github.com/matrix-org/matrix-doc/pull/212
2015-12-07 10:44:33 +00:00
Mark Haines 660dee94af Only include the archived rooms if a include_leave flag in set in the filter 2015-12-04 17:32:09 +00:00
Mark Haines 262a97f02b Merge pull request #422 from matrix-org/markjh/schema
Bump schema version.
2015-12-04 15:45:44 +00:00
Mark Haines d57c5cda71 Bump schema version.
As we released version 26 in v0.11.1
2015-12-04 15:28:39 +00:00
Mark Haines 99e1d6777f Add metrics to track the cpu on the main thread consumed by each type of request 2015-12-04 14:42:24 +00:00
Mark Haines 3c85a317d6 Merge pull request #420 from matrix-org/markjh/resource_usage
Track the cpu used in the main thread by each logging context
2015-12-04 14:15:41 +00:00
Mark Haines 5231737369 Add comments to explain why we are hardcoding RUSAGE_THREAD 2015-12-04 11:53:38 +00:00
Mark Haines d6059bdd2a Fix warnings 2015-12-04 11:34:23 +00:00
Mark Haines 48a2526d62 Track the cpu used in the main thread by each logging context 2015-12-03 21:03:01 +00:00
Mark Haines b29d2fd7f8 Merge pull request #419 from matrix-org/markjh/reuse_captcha_client
Reuse the captcha client rather than creating a new one for each request
2015-12-03 17:00:59 +00:00
Daniel Wagner-Hall edfcb83473 Flatten devices into a dict, not a list 2015-12-03 16:19:21 +00:00
Mark Haines 478b4e3ed4 Reuse the captcha client rather than creating a new one for each request 2015-12-03 13:48:55 +00:00
Erik Johnston b8680b82c3 Merge pull request #414 from matrix-org/erikj/if_not_exists
Older versions of SQLite don't like IF NOT EXISTS in virtual tables
2015-12-03 13:21:09 +00:00
Daniel Wagner-Hall ac213c2e08 Merge pull request #415 from matrix-org/daniel/endpoints
Merge pull request #415 from matrix-org/daniel/endpoints
2015-12-03 12:19:12 +00:00
Daniel Wagner-Hall e880164c59 Merge pull request #418 from matrix-org/daniel/whois
Merge pull request #418 from matrix-org/daniel/whois
2015-12-03 12:18:01 +00:00
Daniel Wagner-Hall 526bc33e02 Fix implementation of /admin/whois 2015-12-02 17:29:47 +00:00
David Baker e515b48929 Just replace the table definition with the one from full_schema 16 2015-12-02 17:23:52 +00:00
David Baker 8810eb8c39 Fix schema delta 15 on postgres in the very unlikley event that anyone upgrades to 15... 2015-12-02 17:19:11 +00:00
Mark Haines 491f3d16dc Make state updates in the C+S API idempotent 2015-12-02 15:50:50 +00:00
Daniel Wagner-Hall 872c134807 Update endpoints to reflect current spec 2015-12-02 15:45:04 +00:00
Erik Johnston f721fdbf87 Merge pull request #412 from matrix-org/erikj/search
Search: Add prefix matching support
2015-12-02 13:56:41 +00:00
Erik Johnston 976cb5aaa8 Throw if unrecognized DB type 2015-12-02 13:50:43 +00:00
Erik Johnston b2def42bfd Older versions of SQLite don't like IF NOT EXISTS in virtual tables 2015-12-02 13:29:14 +00:00
Erik Johnston b9acef5301 Fix so highlight matching works again 2015-12-02 13:28:13 +00:00
Mark Haines 58d0927767 Merge pull request #410 from matrix-org/markjh/edu_frequency
Only fire user_joined_room if the user has actually joined.
2015-12-02 13:17:15 +00:00
Erik Johnston 7dd6e5efca Remove deuplication. Add comment about regex. 2015-12-02 13:09:37 +00:00
Mark Haines 5dc09e82c4 Merge pull request #413 from matrix-org/markjh/reuse_http_client
Reuse a single http client, rather than creating new ones
2015-12-02 12:56:23 +00:00
Mark Haines c2c70f7daf Use the context returned by _handle_new_event 2015-12-02 12:01:24 +00:00
Erik Johnston 477da77b46 Search: Add prefix matching support 2015-12-02 11:40:52 +00:00
Mark Haines 37b2d69bbc Reuse a single http client, rather than creating new ones 2015-12-02 11:36:02 +00:00
David Baker addb248e0b Merge pull request #411 from matrix-org/default_dont_notify
Change the m.room.message rule to be disabled by default
2015-12-02 11:32:56 +00:00
David Baker 4b1281f9b7 Change the m.room.message rule to be disabled by default so we only notify for 1:1 rooms / highlights out-of-the-box 2015-12-02 11:26:49 +00:00
Mark Haines dede14f689 Merge branch 'develop' into markjh/edu_frequency 2015-12-02 10:57:51 +00:00
Mark Haines 5eb4d13aaa Fix typo in collect_presencelike_data 2015-12-02 10:50:58 +00:00
Mark Haines c30cdb0d68 Add comments 2015-12-02 10:49:35 +00:00
Mark Haines 2a0ec3b89d Merge branch 'develop' into markjh/edu_frequency
Conflicts:
	synapse/handlers/federation.py
	synapse/handlers/room.py
2015-12-02 10:40:22 +00:00
Erik Johnston 03b2a6a8aa Merge pull request #409 from MadsRC/develop
Develop
2015-12-02 10:08:18 +00:00
Mark Haines 9fbd504b4e Merge pull request #408 from matrix-org/markjh/distributor_facade
Wrap calls to distributor.fire in appropriately named functions
2015-12-02 09:44:56 +00:00
Erik Johnston 9670f226e3 Merge pull request #406 from matrix-org/erikj/search
Search: Don't disregard grouping info in pagination tokens
2015-12-02 09:13:20 +00:00
Mads R. Christensen 6863466653 Added a single line to explain what the server_name is used for 2015-12-02 00:37:55 +01:00
Mark Haines a9526831a4 Wrap calls to distributor.fire in appropriately named functions so that static analysis can work out want is calling what 2015-12-01 20:53:04 +00:00
Mark Haines ed0f79bdc5 Only fire user_joined_room if the membership has changed 2015-12-01 19:46:15 +00:00
Mark Haines f73ea0bda2 Merge branch 'develop' into markjh/edu_frequency 2015-12-01 19:15:27 +00:00
Mark Haines 95f30ecd1f Add API for setting account_data globaly or on a per room basis 2015-12-01 18:41:32 +00:00
Daniel Wagner-Hall 14d7acfad4 Host /unstable and /r0 versions of r0 APIs 2015-12-01 17:34:32 +00:00
Erik Johnston 27c5e1b374 Search: Don't disregard grouping info in pagination tokens 2015-12-01 16:47:18 +00:00
Mark Haines af96c6f4d3 Merge pull request #404 from matrix-org/markjh/trivial_rename
Rename presence_handler.send_invite
2015-12-01 16:11:03 +00:00
Mark Haines d32db0bc45 Merge pull request #402 from matrix-org/markjh/event_formatting
Copy rather than move the fields to shuffle between a v1 and a v2 event.
2015-12-01 16:10:24 +00:00
Mark Haines 3d3da2b460 Only fire user_joined_room on the distributor if the user has actually joined the room 2015-12-01 16:03:08 +00:00
Mark Haines 31069ecf6a Rename presence_handler.send_invite to presence_handler.send_presence_invite to distinguish it from normal invites 2015-12-01 15:59:45 +00:00
Erik Johnston 71578e2bf2 Change the result tict to be a list 2015-12-01 14:48:35 +00:00
Mark Haines 306415391d Only add the user_id if the sender is present 2015-12-01 11:14:48 +00:00
Erik Johnston da7dd58641 Tidy up a bit 2015-12-01 11:06:40 +00:00
Mark Haines bde8d78b8a Copy rather than move the fields to shuffle between a v1 and a v2 event.
This should make all v1 APIs compatible with v2 clients. While still
allowing v1 clients to access the fields.

This makes the documentation easier since we can just document the v2
format and explain that some of the fields, in some of the APIs are
duplicated for backwards compatibility, rather than having to document
two separate event formats.
2015-11-30 17:46:35 +00:00
Erik Johnston 4dcaa42b6d Allow paginating search ordered by recents 2015-11-30 17:45:31 +00:00
Erik Johnston 76936f43ae Return words to highlight in search results 2015-11-27 16:40:42 +00:00
Erik Johnston 17dd5071ef Allow user to redact with an equal power
Users only need their power level to be equal to the redact level for
them to be allowed to redact events.
2015-11-26 11:17:57 +00:00
Daniel Wagner-Hall df7cf6c0eb Fix SQL for postgres again 2015-11-23 18:54:41 +00:00
Daniel Wagner-Hall 3e573a5c6b Fix SQL for postgres 2015-11-23 18:48:53 +00:00
Daniel Wagner-Hall 7dfa455508 Remove size specifier for database column
Postgres doesn't support them like this.

We don't have a bool type in common between postgres and sqlite.
2015-11-23 18:35:25 +00:00
Daniel Wagner-Hall 924d85a75e Merge pull request #375 from matrix-org/daniel/guestroominitialsync
Clean up room initialSync for guest users
2015-11-23 16:10:49 +00:00
Mark Haines c6a15f5026 Merge pull request #385 from matrix-org/daniel/forgetrooms
Allow users to forget rooms
2015-11-20 18:07:26 +00:00
Erik Johnston 1b64cb019e Merge branch 'erikj/perspective_limiter' into release-v0.11.1 2015-11-20 17:24:23 +00:00
Erik Johnston 0eabfa55f6 Fix typo 2015-11-20 17:17:58 +00:00
Erik Johnston 6408541075 Don't limit connections to perspective servers 2015-11-20 17:15:44 +00:00
Erik Johnston 2c1bc4392f Bump changes and version 2015-11-20 16:35:01 +00:00
Erik Johnston 93f7bb8dd5 Merge pull request #394 from matrix-org/erikj/search
Add options for including state in search results
2015-11-20 16:31:24 +00:00
Richard van der Hoff 1d9c1d4166 Merge pull request #389 from matrix-org/rav/flatten_sync_response
v2 sync: Get rid of the event_map, and rename the keys of the rooms obj
2015-11-20 15:18:55 +00:00
Erik Johnston 3f151da314 Merge pull request #391 from matrix-org/erikj/remove_token_from_flow
Remove m.login.token from advertised flows.
2015-11-20 14:16:59 +00:00
Erik Johnston 6b95a79724 Add option to include the current room state 2015-11-20 14:16:42 +00:00
Erik Johnston e3dae653e8 Comment 2015-11-20 14:05:22 +00:00
Erik Johnston 9de1f328ad Merge pull request #393 from matrix-org/erikj/destination_retry_max
Use min and not max to set an upper bound on retry interval
2015-11-20 13:41:20 +00:00
Erik Johnston 506874cca9 Optionally include historic profile info 2015-11-20 11:39:44 +00:00
Erik Johnston 2f2bbb4d06 Use min and not max to set an upper bound on retry interval 2015-11-20 09:34:58 +00:00
Daniel Wagner-Hall 95c3306798 Merge branch 'daniel/forgetrooms' of github.com:matrix-org/synapse into daniel/forgetrooms 2015-11-19 15:00:14 -05:00
Daniel Wagner-Hall df6824a008 Ignore forgotten rooms in v2 sync 2015-11-19 14:54:47 -05:00
Paul "LeoNerd" Evans dd11bf8a79 Merge branch 'develop' into rav/flatten_sync_response 2015-11-19 17:21:03 +00:00
Paul "LeoNerd" Evans 1cfda3d2d8 Merge branch 'develop' into daniel/forgetrooms 2015-11-19 16:53:13 +00:00
Erik Johnston 8b5349c7bc Merge branch 'master' of github.com:matrix-org/synapse into develop 2015-11-19 16:17:54 +00:00
Erik Johnston 37de8a7f4a Remove m.login.token from advertised flows. 2015-11-19 16:16:49 +00:00
Mark Haines 7a802ec0ff Merge pull request #386 from matrix-org/markjh/rename_pud_to_account_data
s/private_user_data/account_data/
2015-11-19 15:21:35 +00:00
Daniel Wagner-Hall 248cfd5eb3 Take a boolean not a list of lambdas 2015-11-19 15:16:25 +00:00
Daniel Wagner-Hall 9da4c5340d Simplify code 2015-11-19 10:07:21 -05:00
Erik Johnston 5fcef78c6a Bump changes and version 2015-11-19 13:09:48 +00:00
Erik Johnston 06f74068f4 Comment 2015-11-19 13:05:51 +00:00
Richard van der Hoff f6e092f6cc Put back the 'state.events' subobject
We're keeping 'events', in case we decide to add more keys later.
2015-11-19 12:23:42 +00:00
Richard van der Hoff 24ae0eee8e v2 /sync: Rename the keys of the 'rooms' object to match member states
joined->join
invited->invite
archived->leave
2015-11-19 10:51:12 +00:00
Richard van der Hoff 3c3fc6b268 Flatten the /sync response to remove the event_map 2015-11-19 10:51:11 +00:00
Daniel Wagner-Hall bed7889703 Apply forgetting properly to historical events 2015-11-18 18:11:12 -05:00
Erik Johnston 037ce4c68f Split out text for missing config options.
This allows packages to more easily override the default messages to
include package specific options.
2015-11-18 18:37:05 +00:00
Mark Haines d153f482dd Rename the database table 2015-11-18 15:33:02 +00:00
Mark Haines 1c960fbb80 s/private_user_data/account_data/ 2015-11-18 15:31:04 +00:00
Daniel Wagner-Hall ba26eb3d5d Allow users to forget rooms 2015-11-17 17:17:30 -05:00
Erik Johnston cf844e2ad6 Bump changelog and version 2015-11-17 18:48:32 +00:00
Erik Johnston cbf3cd6151 Add comment 2015-11-17 18:29:29 +00:00
Erik Johnston cf4ef5f3c7 Only retry federation requests for a long time for background requests 2015-11-17 18:26:50 +00:00
Erik Johnston afdfd12bdf Implement required method 'resumeProducing' 2015-11-17 16:57:06 +00:00
Erik Johnston bceec65913 Slightly more aggressive retry timers at HTTP level 2015-11-17 15:10:05 +00:00
Erik Johnston 9eff52d1a6 Bump changelog and version 2015-11-17 14:38:36 +00:00
Erik Johnston 0186aef814 Merge branch 'develop' of github.com:matrix-org/synapse into release-v0.11.0 2015-11-17 14:37:13 +00:00
Steven Hammerton f20d064e05 Always check guest = true in macaroons 2015-11-17 10:58:05 +00:00
Steven Hammerton f5e25c5f35 Merge branch 'develop' into sh-cas-auth-via-homeserver 2015-11-17 10:55:41 +00:00
Paul "LeoNerd" Evans aca6e5bf46 Don't complain if /make_join response lacks 'prev_state' list (SYN-517) 2015-11-13 17:27:25 +00:00
Daniel Wagner-Hall 641420c5e0 Clean up room initialSync for guest users 2015-11-13 15:44:57 +00:00
Daniel Wagner-Hall 9c3f4f8dfd Allow guests to /room/:room_id/{join,leave} 2015-11-13 11:56:58 +00:00
Erik Johnston 0644f0eb7d Bump version and change log 2015-11-13 11:43:29 +00:00
Richard van der Hoff e4d622aaaf Implementation of state rollback in /sync
Implementation of SPEC-254: roll back the state dictionary to how it looked at
the start of the timeline.

Merged PR https://github.com/matrix-org/synapse/pull/373
2015-11-13 10:58:56 +00:00
Richard van der Hoff fddedd51d9 Fix a few race conditions in the state calculation
Be a bit more careful about how we calculate the state to be returned by
/sync. In a few places, it was possible for /sync to return slightly later
state than that represented by the next_batch token and the timeline. In
particular, the following cases were susceptible:

* On a full state sync, for an active room
* During a per-room incremental sync with a timeline gap
* When the user has just joined a room. (Refactor check_joined_room to make it
  less magical)

Also, use store.get_state_for_events() (and thus the existing stategroups) to
calculate the state corresponding to a particular sync position, rather than
state_handler.compute_event_context(), which recalculates from first principles
(and tends to miss some state).

Merged from PR https://github.com/matrix-org/synapse/pull/372
2015-11-13 10:39:09 +00:00
Richard van der Hoff 5ab4b0afe8 Make handlers.sync return a state dictionary, instead of an event list.
Basically this moves the process of flattening the existing dictionary into a
list up to rest.client.*, instead of doing it in handlers.sync. This simplifies
a bit of the code in handlers.sync, but it is also going to be somewhat
beneficial in the next stage of my hacking on SPEC-254.

Merged from PR #371
2015-11-13 10:35:01 +00:00
Richard van der Hoff 5dea4d37d1 Update some comments
Add a couple of type annotations, docstrings, and other comments, in the
interest of keeping track of what types I have.

Merged from pull request #370.
2015-11-13 10:31:15 +00:00
Daniel Wagner-Hall fc27ca9006 Merge pull request #369 from matrix-org/daniel/guestnonevents
Return non-room events from guest /events calls
2015-11-12 17:28:48 +00:00
Daniel Wagner-Hall 468a2ed4ec Return non-room events from guest /events calls 2015-11-12 16:45:28 +00:00
Erik Johnston 018b504f5b Merge pull request #368 from matrix-org/erikj/fix_federation_profile
Fix missing profile data in federation joins
2015-11-12 16:30:02 +00:00
Erik Johnston 49f1758d74 Merge pull request #366 from matrix-org/erikj/search_fix_sqlite_faster
Use a (hopefully) more efficient SQL query for doing recency based room search
2015-11-12 16:24:32 +00:00
Erik Johnston c0b3554401 Fix missing profile data in federation joins
There was a regression where we stopped including profile data in
initial joins for rooms joined over federation.
2015-11-12 16:19:55 +00:00
Erik Johnston 3de46c7755 Trailing whitespace 2015-11-12 15:36:43 +00:00
Erik Johnston 8fd8e72cec Expand comment 2015-11-12 15:33:47 +00:00
Richard van der Hoff 78f6010207 Fix an issue with ignoring power_level changes on divergent graphs
Changes to m.room.power_levels events are supposed to be handled at a high
priority; however a typo meant that the relevant bit of code was never
executed, so they were handled just like any other state change - which meant
that a bad person could cause room state changes by forking the graph from a
point in history when they were allowed to do so.
2015-11-12 15:24:59 +00:00
Daniel Wagner-Hall 06bfd0a3c0 Merge pull request #367 from matrix-org/daniel/readafterleave
Merge pull request #367 from matrix-org/daniel/readafterleave

Tweak guest access permissions
2015-11-12 15:22:02 +00:00
Erik Johnston 764e79d051 Comment 2015-11-12 15:19:56 +00:00
Daniel Wagner-Hall 0d08670f61 Merge pull request #360 from matrix-org/daniel/guestroominitialsync
Merge pull request #360 from matrix-org/daniel/guestroominitialsync

Allow guest access to room initialSync
2015-11-12 15:19:55 +00:00
Erik Johnston 320408ef47 Fix SQL syntax 2015-11-12 15:09:45 +00:00
Daniel Wagner-Hall fb7e260a20 Tweak guest access permissions
* Allow world_readable rooms to be read by guests who have joined and
   left
 * Allow regular users to access world_readable rooms
2015-11-12 15:02:00 +00:00