13
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
-
17
16
import collections
18
17
import logging
19
18
import re
20
19
from abc import abstractmethod
21
20
from enum import Enum
22
21
from typing import Any , Dict , List , Optional , Tuple
23
22
24
- from synapse .api .constants import EventTypes
23
+ from synapse .api .constants import EventTypes , JoinRules
25
24
from synapse .api .errors import StoreError
26
25
from synapse .api .room_versions import RoomVersion , RoomVersions
27
26
from synapse .storage ._base import SQLBaseStore , db_to_json
@@ -178,12 +177,13 @@ def _count_public_rooms_txn(txn):
178
177
INNER JOIN room_stats_current USING (room_id)
179
178
WHERE
180
179
(
181
- join_rules = 'public' OR join_rules = 'knock '
180
+ join_rules = 'public' OR join_rules = '%(knock_join_rule)s '
182
181
OR history_visibility = 'world_readable'
183
182
)
184
183
AND joined_members > 0
185
184
""" % {
186
- "published_sql" : published_sql
185
+ "published_sql" : published_sql ,
186
+ "knock_join_rule" : JoinRules .KNOCK ,
187
187
}
188
188
189
189
txn .execute (sql , query_args )
@@ -314,7 +314,7 @@ async def get_largest_public_rooms(
314
314
INNER JOIN room_stats_current USING (room_id)
315
315
WHERE
316
316
(
317
- join_rules = 'public' OR join_rules = 'knock '
317
+ join_rules = 'public' OR join_rules = '%(knock_join_rule)s '
318
318
OR history_visibility = 'world_readable'
319
319
)
320
320
AND joined_members > 0
@@ -324,6 +324,7 @@ async def get_largest_public_rooms(
324
324
"published_sql" : published_sql ,
325
325
"where_clause" : where_clause ,
326
326
"dir" : "DESC" if forwards else "ASC" ,
327
+ "knock_join_rule" : JoinRules .KNOCK ,
327
328
}
328
329
329
330
if limit is not None :
0 commit comments