Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: Introduces application-wide time format setting. #917

Closed
wants to merge 1 commit into from

Conversation

mkp6781
Copy link
Contributor

@mkp6781 mkp6781 commented Feb 12, 2021

Initial time format settings are fetched during initial register call.
Event handler enables update of this setting as events are recieved
from the server.

Fixes #770

@zulipbot zulipbot added size: L [Automatic label added by zulipbot] enhancement New feature or request further discussion required Discuss this on #zulip-terminal on chat.zulip.org labels Feb 12, 2021
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkp6781 Thanks for following up on this after the refactor in the other PR 👍

This looks broadly good in practice, though I did note that with the year included the am/pm drops onto another line? (eg. look at messages before/after new-year 2020/2021)

zulipterminal/model.py Outdated Show resolved Hide resolved
zulipterminal/ui_tools/boxes.py Outdated Show resolved Hide resolved
Comment on lines 1921 to 1962
@pytest.mark.parametrize('event, twenty_four_hr_format', [
({'setting_name': 'twenty_four_hour_time',
'setting': True}, False),
], ids=['twenty_four_hour_time'])
def test__handle_update_display_settings(self, mocker, model,
twenty_four_hr_format,
event):
event['type'] = 'update_display_settings'

# Test for change in time format
if event['setting_name'] == 'twenty_four_hour_time':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a test for only the 24-hour update, and it's likely best to keep it at that - name it that, and if we add other settings event updates then we can write separate tests as we need them, or adapt this one. Those extra parameters are just one set, which you could put as a dict in the body of the test.

You're only testing False -> True? A lot of those parameters are constants once you focus on just this part of the event, and you can focus on the values of the settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're only testing False -> True? A lot of those parameters are constants once you focus on just this part of the event, and you can focus on the values of the settings.

Should I add tests for checking whether create_msg_box_list is being called and a separate test for formatted_local_time?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both in the same test seems OK for now. I'll look again in the next iteration.

@neiljp neiljp added the PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback label Feb 14, 2021
@neiljp neiljp removed the further discussion required Discuss this on #zulip-terminal on chat.zulip.org label Feb 17, 2021
@mkp6781
Copy link
Contributor Author

mkp6781 commented Feb 19, 2021

@zulipbot add "PR needs review"

@zulipbot zulipbot added the PR needs review PR requires feedback to proceed label Feb 19, 2021
@mkp6781
Copy link
Contributor Author

mkp6781 commented Feb 19, 2021

This looks broadly good in practice, though I did note that with the year included the am/pm drops onto another line? (eg. look at messages before/after new-year 2020/2021)

I missed looking into this part. I'll make the change along with next iteration.

Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkp6781 Just to let you know that the conflict is related to the year-related code I just merged from #930, which should also help clarify the comment from the last review re strftime. I left some comments, but this looks fairly ready to go if we can resolve these points well and get the missed points from the last review.

tests/model/test_model.py Outdated Show resolved Hide resolved
tests/model/test_model.py Outdated Show resolved Hide resolved
@neiljp neiljp removed the PR needs review PR requires feedback to proceed label Feb 20, 2021
Initial time format settings are fetched during initial register call.
Event handler enables update of this setting as events are recieved
from the server.

Tests added.

Fixes zulip#770
@neiljp
Copy link
Collaborator

neiljp commented Feb 21, 2021

@mkp6781 Thanks for working on the server-related part of this after the refactoring PR 👍 I just manually merged this with some minor test and naming changes for consistency as 0608209 🎉

For reference, this would also have been fine as a "use initial data" commit followed by an "update based on events" commit - this PR should be simple enough that we've not overlooked anything that may have been clearer in that form 👍

@neiljp neiljp closed this Feb 21, 2021
@neiljp neiljp added this to the Next Release milestone Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback size: L [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce application-wide time format setting
3 participants