Skip to content

Commit

Permalink
Merge branch 'element-master' of github.com:vector-im/mautrix-telegra…
Browse files Browse the repository at this point in the history
…m into element-master
  • Loading branch information
Half-Shot committed Nov 18, 2021
2 parents d2dae08 + 8d0e1f2 commit 9c0a42d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
16 changes: 7 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,16 @@ RUN apk add --no-cache \

COPY requirements.txt /opt/mautrix-telegram/requirements.txt
WORKDIR /opt/mautrix-telegram
RUN apk add --virtual .build-deps \
python3-dev \
libffi-dev \
build-base \
&& pip3 install -r requirements.txt \
&& apk del .build-deps

COPY . /opt/mautrix-telegram
RUN apk add git && pip3 install .[speedups,hq_thumbnails,metrics,e2be] \
&& pip3 install 'git+https://github.com/vector-im/mautrix-python@bump-conn-pool-limit#egg=mautrix' \
RUN apk add git \
&& apk add --virtual .build-deps python3-dev libffi-dev build-base \
&& pip3 install .[speedups,hq_thumbnails,metrics,e2be] \
# TODO: unpin Pillow here after it's updated in Alpine
&& pip3 install -r requirements.txt 'pillow==8.2' \
&& pip3 install 'git+https://github.com/vector-im/[email protected]#egg=mautrix' \
&& apk del git \
# This doesn't make the image smaller, but it's needed so that the `version` command works properly
&& apk del .build-deps \
&& cp mautrix_telegram/example-config.yaml . && rm -rf mautrix_telegram

VOLUME /data
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The Element fork includes the following changes:
- Make max_initial_member_sync work for Chats as well as Channels https://github.com/mautrix/telegram/pull/680
- Allow disabling user status updates from Telegram side https://github.com/vector-im/mautrix-telegram/pull/9
- Add `psycopg2`, `uvloop` to requirements.txt, install_requires https://github.com/vector-im/mautrix-telegram/pull/10/files
- Bumping the maximum concurrent HTTP connection count https://github.com/vector-im/mautrix-python/tree/bump-conn-pool-limit
- Add metrics about Matrix API calls https://github.com/mautrix/python/pull/68

Some changes that appear here may get upstreamed to https://github.com/mautrix/telegram, and will be removed from
the list when they appear in both versions.
Expand Down
2 changes: 1 addition & 1 deletion mautrix_telegram/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.10.1-mod-7"
__version__ = "0.10.2-mod-1"
__author__ = "Tulir Asokan <[email protected]>"
6 changes: 3 additions & 3 deletions mautrix_telegram/db/user_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import Optional, Iterable

from sqlalchemy import Column, Integer, BigInteger
from sqlalchemy import Column, Integer, BigInteger, func, select
from sqlalchemy.ext.hybrid import hybrid_property

from mautrix.util.db import Base
Expand Down Expand Up @@ -76,7 +76,7 @@ def activity_days(self):
def get_active_count(cls, min_activity_days: int, max_activity_days: Optional[int]) -> int:
current_ms = time.time() * 1000

query = cls.t.select().where(cls.activity_days > min_activity_days)
query = select([func.count(UserActivity.puppet_id)]).where(cls.activity_days > min_activity_days)
if max_activity_days is not None:
query = query.where((current_ms - cls.last_activity_ts) <= (max_activity_days * ONE_DAY_MS))
return cls.db.execute(query.count()).scalar()
return cls.db.execute(query).scalar()

0 comments on commit 9c0a42d

Please sign in to comment.