From 1cf903add79ca7fe887e670d1065be329cdacca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Ja=C5=A1ek?= Date: Thu, 26 Oct 2023 15:21:24 +0200 Subject: [PATCH 1/3] fix display of empty topics message (#638) * fix display of empty topics message so it's visible based on selected my/company topics. CPCN-415 * fix 0 handling in gettext replace --- assets/components/PersonalizeHomeModal.tsx | 10 ++++++---- assets/utils.tsx | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/assets/components/PersonalizeHomeModal.tsx b/assets/components/PersonalizeHomeModal.tsx index 59eb3b776..b071cdb15 100644 --- a/assets/components/PersonalizeHomeModal.tsx +++ b/assets/components/PersonalizeHomeModal.tsx @@ -172,12 +172,14 @@ class PersonalizeHomeModal extends React.Component { const topicSearch = (searchMatches?.length ?? 0) > 0 ? ( -
+
{searchMatches}
- ) : ; + ) : null; + + const hasTopics = (filteredTopics(this.wireTopics).length ?? 0) > 0; - const groupedTopics = (this.props.topics?.length ?? 0) > 0 ? ( + const groupedTopics = hasTopics ? (
{filteredTopics(this.wireTopics).map((wireTopic) => ( @@ -309,7 +311,7 @@ class PersonalizeHomeModal extends React.Component {
- {this.state.searchTerm ? topicSearch : groupedTopics} + {this.state.searchTerm && hasTopics ? topicSearch : groupedTopics}
{ const paramRegexp = new RegExp('{{ ?' + param + ' ?}}', 'g'); - translated = translated.replace(paramRegexp, params[param] || ''); + translated = translated.replace(paramRegexp, params[param] != null ? params[param] : ''); }); } From 896d0daa65029d9e0e2d5d5dde03c313c8ca3782 Mon Sep 17 00:00:00 2001 From: fritzSF Date: Thu, 26 Oct 2023 15:52:51 +0200 Subject: [PATCH 2/3] CSS error fix (#639) * CSS error fix --- assets/styles/article-list.scss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/styles/article-list.scss b/assets/styles/article-list.scss index 95e82f3d9..c03613353 100644 --- a/assets/styles/article-list.scss +++ b/assets/styles/article-list.scss @@ -93,8 +93,8 @@ .wire-articles__item__meta-info .bold { color: var(--color-text--muted); } - .wire-articles__wire-articles__item__metaitem__meta-info .bold { - font-weight: 500; + .wire-articles__item__meta-info .bold { + font-weight: 600; } } @@ -561,7 +561,7 @@ margin: 0; .bold { color: var(--color-text); - font-weight: 500; + font-weight: 600; } .versions-link { color: var(--color-text-link); From 92d4acb4f156ef9b11a4287ab1d310b11624823b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Ja=C5=A1ek?= Date: Fri, 27 Oct 2023 10:22:17 +0200 Subject: [PATCH 3/3] fix password reset not working on custom cp reset page (#640) - avoid checking permissions when storing the token CPCN-434 --- .github/workflows/lint.yml | 18 ++++++++++++------ newsroom/auth/utils.py | 2 +- newsroom/users/users.py | 4 ---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 272d2a8a0..373881ab6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,23 +7,29 @@ jobs: flake8: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' - run: pip install flake8 - run: flake8 mypy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' - run: pip install -Ur mypy-requirements.txt - run: mypy . black: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' - run: pip install black~=23.0 - run: black --check . diff --git a/newsroom/auth/utils.py b/newsroom/auth/utils.py index 0a3242d70..306d8449d 100644 --- a/newsroom/auth/utils.py +++ b/newsroom/auth/utils.py @@ -138,7 +138,7 @@ def send_token(user, token_type="validate", update_token=True): if update_token: updates = {} add_token_data(updates) - superdesk.get_resource_service("users").patch(id=bson.ObjectId(user["_id"]), updates=updates) + superdesk.get_resource_service("users").system_update(bson.ObjectId(user["_id"]), updates, user) token = updates["token"] if token_type == "validate": diff --git a/newsroom/users/users.py b/newsroom/users/users.py index ed0731a0a..09987e844 100644 --- a/newsroom/users/users.py +++ b/newsroom/users/users.py @@ -365,10 +365,6 @@ def check_permissions(self, doc, updates=None): elif request and request.method == "DELETE" and doc.get("_id") != manager.get("_id"): return - if request.url_rule and request.url_rule.rule: - if request.url_rule.rule in ["/reset_password/", "/token/"]: - return - if request.method != "DELETE" and ( not updated_fields or all([key in USER_PROFILE_UPDATES for key in updated_fields]) ):