Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/2.5' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
petrjasek committed Oct 27, 2023
2 parents 56b6cb8 + 92d4acb commit 89c5a61
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
10 changes: 6 additions & 4 deletions assets/components/PersonalizeHomeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,14 @@ class PersonalizeHomeModal extends React.Component<IProps, IState> {

const topicSearch = (searchMatches?.length ?? 0) > 0
? (
<div style={{padding: 4}}>
<div className='boxed-checklist'>
{searchMatches}
</div>
) : <NoSearchMatches />;
) : null;

const hasTopics = (filteredTopics(this.wireTopics).length ?? 0) > 0;

const groupedTopics = (this.props.topics?.length ?? 0) > 0 ? (
const groupedTopics = hasTopics ? (
<div>
<div className='boxed-checklist'>
{filteredTopics(this.wireTopics).map((wireTopic) => (
Expand Down Expand Up @@ -308,7 +310,7 @@ class PersonalizeHomeModal extends React.Component<IProps, IState> {
</div>
</form>
</div>
{this.state.searchTerm ? topicSearch : groupedTopics}
{this.state.searchTerm && hasTopics ? topicSearch : groupedTopics}
</div>
</aside>
<div
Expand Down
2 changes: 1 addition & 1 deletion assets/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function gettext(text: string, params?: {[key: string]: any}): string {
if (params) {
Object.keys(params).forEach((param: string) => {
const paramRegexp = new RegExp('{{ ?' + param + ' ?}}', 'g');
translated = translated.replace(paramRegexp, params[param] || '');
translated = translated.replace(paramRegexp, params[param] != null ? params[param] : '');
});
}

Expand Down
2 changes: 1 addition & 1 deletion newsroom/auth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 0 additions & 4 deletions newsroom/users/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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>", "/token/<token_type>"]:
return

if request.method != "DELETE" and (
not updated_fields or all([key in USER_PROFILE_UPDATES for key in updated_fields])
):
Expand Down

0 comments on commit 89c5a61

Please sign in to comment.