mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Rename event-actions to event_push_actions as per PR request
This commit is contained in:
parent
928c575c6f
commit
c914d67cda
@ -896,7 +896,7 @@ class SyncHandler(BaseHandler):
|
|||||||
|
|
||||||
notifs = []
|
notifs = []
|
||||||
if last_unread_event_id:
|
if last_unread_event_id:
|
||||||
notifs = yield self.store.get_unread_event_actions_by_room_for_user(
|
notifs = yield self.store.get_unread_event_push_actions_by_room_for_user(
|
||||||
room_id, sync_config.user.to_string(), last_unread_event_id
|
room_id, sync_config.user.to_string(), last_unread_event_id
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -27,7 +27,7 @@ import random
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
# Pushers could now be moved to pull out of the event_actions table instead
|
# Pushers could now be moved to pull out of the event_push_actions table instead
|
||||||
# of listening on the event stream: this would avoid them having to run the
|
# of listening on the event stream: this would avoid them having to run the
|
||||||
# rules again.
|
# rules again.
|
||||||
class Pusher(object):
|
class Pusher(object):
|
||||||
|
@ -40,7 +40,7 @@ class ActionGenerator:
|
|||||||
|
|
||||||
actions_by_user = bulk_evaluator.action_for_event_by_user(event)
|
actions_by_user = bulk_evaluator.action_for_event_by_user(event)
|
||||||
|
|
||||||
yield self.store.set_actions_for_event_and_users(
|
yield self.store.set_push_actions_for_event_and_users(
|
||||||
event,
|
event,
|
||||||
[
|
[
|
||||||
(uid, None, actions) for uid, actions in actions_by_user.items()
|
(uid, None, actions) for uid, actions in actions_by_user.items()
|
||||||
|
@ -33,7 +33,7 @@ from .pusher import PusherStore
|
|||||||
from .push_rule import PushRuleStore
|
from .push_rule import PushRuleStore
|
||||||
from .media_repository import MediaRepositoryStore
|
from .media_repository import MediaRepositoryStore
|
||||||
from .rejections import RejectionsStore
|
from .rejections import RejectionsStore
|
||||||
from .event_actions import EventActionsStore
|
from .event_push_actions import EventPushActionsStore
|
||||||
|
|
||||||
from .state import StateStore
|
from .state import StateStore
|
||||||
from .signatures import SignatureStore
|
from .signatures import SignatureStore
|
||||||
@ -76,7 +76,7 @@ class DataStore(RoomMemberStore, RoomStore,
|
|||||||
SearchStore,
|
SearchStore,
|
||||||
TagsStore,
|
TagsStore,
|
||||||
AccountDataStore,
|
AccountDataStore,
|
||||||
EventActionsStore
|
EventPushActionsStore
|
||||||
):
|
):
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
|
@ -22,9 +22,9 @@ import simplejson as json
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class EventActionsStore(SQLBaseStore):
|
class EventPushActionsStore(SQLBaseStore):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def set_actions_for_event_and_users(self, event, tuples):
|
def set_push_actions_for_event_and_users(self, event, tuples):
|
||||||
"""
|
"""
|
||||||
:param event: the event set actions for
|
:param event: the event set actions for
|
||||||
:param tuples: list of tuples of (user_id, profile_tag, actions)
|
:param tuples: list of tuples of (user_id, profile_tag, actions)
|
||||||
@ -42,15 +42,15 @@ class EventActionsStore(SQLBaseStore):
|
|||||||
yield self.runInteraction(
|
yield self.runInteraction(
|
||||||
"set_actions_for_event_and_users",
|
"set_actions_for_event_and_users",
|
||||||
self._simple_insert_many_txn,
|
self._simple_insert_many_txn,
|
||||||
EventActionsTable.table_name,
|
EventPushActionsTable.table_name,
|
||||||
values
|
values
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_unread_event_actions_by_room_for_user(
|
def get_unread_event_push_actions_by_room_for_user(
|
||||||
self, room_id, user_id, last_read_event_id
|
self, room_id, user_id, last_read_event_id
|
||||||
):
|
):
|
||||||
def _get_unread_event_actions_by_room(txn):
|
def _get_unread_event_push_actions_by_room(txn):
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT stream_ordering, topological_ordering"
|
"SELECT stream_ordering, topological_ordering"
|
||||||
" FROM events"
|
" FROM events"
|
||||||
@ -68,7 +68,7 @@ class EventActionsStore(SQLBaseStore):
|
|||||||
|
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT ea.event_id, ea.actions"
|
"SELECT ea.event_id, ea.actions"
|
||||||
" FROM event_actions ea, events e"
|
" FROM event_push_actions ea, events e"
|
||||||
" WHERE ea.room_id = e.room_id"
|
" WHERE ea.room_id = e.room_id"
|
||||||
" AND ea.event_id = e.event_id"
|
" AND ea.event_id = e.event_id"
|
||||||
" AND ea.user_id = ?"
|
" AND ea.user_id = ?"
|
||||||
@ -88,11 +88,11 @@ class EventActionsStore(SQLBaseStore):
|
|||||||
]
|
]
|
||||||
|
|
||||||
ret = yield self.runInteraction(
|
ret = yield self.runInteraction(
|
||||||
"get_unread_event_actions_by_room",
|
"get_unread_event_push_actions_by_room",
|
||||||
_get_unread_event_actions_by_room
|
_get_unread_event_push_actions_by_room
|
||||||
)
|
)
|
||||||
defer.returnValue(ret)
|
defer.returnValue(ret)
|
||||||
|
|
||||||
|
|
||||||
class EventActionsTable(object):
|
class EventPushActionsTable(object):
|
||||||
table_name = "event_actions"
|
table_name = "event_push_actions"
|
@ -13,7 +13,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS event_actions(
|
CREATE TABLE IF NOT EXISTS event_push_actions(
|
||||||
room_id TEXT NOT NULL,
|
room_id TEXT NOT NULL,
|
||||||
event_id TEXT NOT NULL,
|
event_id TEXT NOT NULL,
|
||||||
user_id TEXT NOT NULL,
|
user_id TEXT NOT NULL,
|
||||||
@ -23,4 +23,4 @@ CREATE TABLE IF NOT EXISTS event_actions(
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE INDEX event_actions_room_id_event_id_user_id_profile_tag on event_actions(room_id, event_id, user_id, profile_tag);
|
CREATE INDEX event_push_actions_room_id_event_id_user_id_profile_tag on event_push_actions(room_id, event_id, user_id, profile_tag);
|
Loading…
Reference in New Issue
Block a user