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

Menu for picking mute time for specific chat #3678

Merged
merged 1 commit into from
Aug 4, 2017

Conversation

mymedia2
Copy link
Contributor

Now, an user can choose silent time for a specific chat using Telegram Desktop, like on mobile platforms. The pop-up window may be caused by context menu of dialog list, and it is as follows.

2017-07-19 18-21-42

@stek29
Copy link
Contributor

stek29 commented Jul 19, 2017

Would be nice to have "mute for X hours" in notifications, but I'm not sure of it'd fit.
This's not directly related to this PR, yes.


setDimensions(st::boxWidth, y);
}
// vi: ts=4 tw=80
Copy link
Member

Choose a reason for hiding this comment

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

What's that? :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Settings for vi(m) so tab and line folding works correctly.

@john-preston
Copy link
Member

@mymedia2 Thanks for your work. This one looks really nice.

#include "ui/widgets/checkbox.h"
#include "ui/widgets/labels.h"

void MuteSettingsBox::prepare()
Copy link
Member

Choose a reason for hiding this comment

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

Please follow the coding style of the rest of the source code, placing the opening curly on the same line that the method name.

/* This class implements a dialog-box with radio-buttons for pick duration of
* turning off notifications from a chat. The widget is opened by a context menu
* in the left list of dialogues. */
class MuteSettingsBox
Copy link
Member

Choose a reason for hiding this comment

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

Please follow the coding style of the rest of the source code, placing the parent class name and the opening curly on the same line that the class name.

: public BoxContent
{
Q_OBJECT
public:
Copy link
Member

Choose a reason for hiding this comment

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

Coding style: Please place a newline before "public:".

public:
MuteSettingsBox(QWidget* parent, PeerData* peer)
: _peer(peer)
{
Copy link
Member

Choose a reason for hiding this comment

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

Coding style: Please place an open curly on the same line as the last member initialization.

{
Q_OBJECT
public:
MuteSettingsBox(QWidget* parent, PeerData* peer)
Copy link
Member

Choose a reason for hiding this comment

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

Please use "gsl::not_null<PeerData*>" here, because "nullptr" value is not allowed here.

protected:
void prepare() override;
private:
PeerData* _peer;
Copy link
Member

Choose a reason for hiding this comment

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

Please use "gsl::not_null<PeerData*>" here, because "nullptr" value is not allowed here. Also please place a newline before the closing curly of the class definition.

}
protected:
void prepare() override;
private:
Copy link
Member

Choose a reason for hiding this comment

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

Coding style: Please place a newline before "private:".

: _peer(peer)
{
}
protected:
Copy link
Member

Choose a reason for hiding this comment

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

Coding style: Please place a newline before "protected:".

private:
PeerData* _peer;
};
// vi: ts=4 tw=80
Copy link
Member

Choose a reason for hiding this comment

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

What's that? :)

Copy link
Member

@john-preston john-preston left a comment

Choose a reason for hiding this comment

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

Contributing policy in general limits pull requests that add new UI elements and / or change the app logic.

But this one looks really nice and really well done, so I'll happily make an exception when some minor changes will be introduced.

I'm not sure that the logic will stay that way in the future (for myself I almost always, 99% of times, disable notifications forever - so I loose a way to do that in two clicks from the context menu and get one more transitional box), but currently this clearly adds value to the user experience.

@mymedia2
Copy link
Contributor Author

mymedia2 commented Jul 24, 2017 via email

Closes: telegramdesktop#3153
Signed-off-by: Nicholas Guriev <[email protected]> (github: mymedia2)
@ghost
Copy link

ghost commented Jul 24, 2017

Looks good, but why 18 hours? That seems a bit arbitrary. But then again, the Android client's options (1 hour, 8 hours, 2 days) are also quite arbitrary. Would be nice if you could specify a more precise time (at least X hours), although I also rarely mute notifications only temporarily.

// the icon is always higher than this chat title
y += icon->height() + st::boxMediumSkip;

const int FOREVER = 8760; // in fact, this is mute only for 1 year
Copy link

Choose a reason for hiding this comment

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

So that's why muting notifications resets after a year. That's a bit misleading. Is this an API limitation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is. As far as I can see, there is no true way to mute a chat for ever. And one year was previous behaviour.
See https://core.telegram.org/type/PeerNotifySettings

Copy link
Contributor

Choose a reason for hiding this comment

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

Nobody said you can't use INT_MAX, as I suggested. But somehow telegram decided to hardcore 1 year in most clients.

Copy link

@ghost ghost Jul 26, 2017

Choose a reason for hiding this comment

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

Interesting. Not sure why they don't use INT_MAX, but then people would see chats unmuted in 2038 if they still use Telegram... MTProto will need some Y2K38-proofing there eventually. ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

@nyuszika7h 2038 is better than 2018 :)

@john-preston john-preston merged commit 24fc162 into telegramdesktop:dev Aug 4, 2017
@john-preston
Copy link
Member

Thanks for your work!

This was referenced Aug 10, 2017
@@ -2244,9 +2245,16 @@ void MainWidget::fillPeerMenu(PeerData *peer, base::lambda<QAction*(const QStrin
Ui::showPeerProfile(peer);
});
auto muteSubscription = MakeShared<base::Subscription>();
auto muteAction = callback(lang(peer->isMuted() ? lng_enable_notifications_from_tray : lng_disable_notifications_from_tray), [peer, muteSubscription] {
Copy link
Member

Choose a reason for hiding this comment

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

I've accidentally discovered that you've removed "muteSubscription" from the capture list of this handler lambda and that broke the realtime update of that button =(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought the muteSubscription variable wasn't used in that lambda. Okay, I'll make PR to fix it.

@github-actions
Copy link

github-actions bot commented Mar 4, 2021

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants