-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
enh(user_status): set OoO status and message #41461
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat
Going into DND works if I clear my test user's status and backup status from oc_user_status. Edit: but status is saved as user defined?! This means absence is never checked again, so DND will not end automatically. Does not do anything if there is an existing backup status. Does this conflict with another automation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not fully work as expected yet
e294c05
to
4895e65
Compare
This is a general problem with the current code - there is no reverting a DND status if I use This needs to be fixed in the follow up ticket #41441 which will add a method to allow to also set a custom message for the different automations we have. This will also help with the inflationary use of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting into OOO status works. Getting out doesn't
Like #41461 (comment) says
a7bed65
to
90cdd5c
Compare
What's missing here? :) |
22c9e73
to
96e0218
Compare
|
Signed-off-by: Anna Larch <[email protected]>
96e0218
to
14b18cc
Compare
To keep things reviewable, please stay with fixup commits. I can't follow your changes if I have to review the full diff with every push 🙏 |
Edit: happens with latest state as well |
|
@miaulalala could you please drop a few lines describing how status automation now works conceptually? I see the old availability automation is gone. OOO changes are also reflected instantly, so I assume there is no caching yet? |
$qb = $this->db->getQueryBuilder(); | ||
$qb->delete($this->tableName) | ||
->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId))) | ||
->andWhere($qb->expr()->eq('message_id', $qb->createNamedParameter($messageId))) | ||
// ->andWhere($qb->expr()->eq('message_id', $qb->createNamedParameter($messageId))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
$this->mapper->update($userStatus); | ||
} | ||
} | ||
// The "online vs away" stuff will need to be reimplemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this leave the live status in any worse state than current master?
} | ||
} | ||
// The "online vs away" stuff will need to be reimplemented | ||
// the Status Listerner should only update the status, but not touch the messages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a change I don't think we can do for 28. this also needs new public APIs and likely breaking of the existing
// calendar status. | ||
// If there is, we have a more up- to- date userDefined status which should take precedence. | ||
$this->backupCurrentStatus($userId); | ||
// @todo - when a user has the option set to set the status to DND outside of office hours, we should respect that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo in this pr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly can do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do it here if this is a required change
skip if it's optional or not needed. I just want to make sure this isn't forgotten if required
@@ -92,13 +94,14 @@ const mutations = { | |||
* @param {string} data.icon The icon | |||
* @param {number} data.clearAt When to automatically clear the status | |||
*/ | |||
setCustomMessage(state, { message, icon, clearAt }) { | |||
setCustomMessage(state, { message, icon, clearAt, isUserDefined = false }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the frontend always sends false
, so we could even remove the option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even more confusing as everything the user can click in the frontend actually IS "user defined"
@@ -49,81 +52,89 @@ protected function setUp(): void { | |||
$db = Server::get(IDBConnection::class); | |||
$qb = $db->getQueryBuilder(); | |||
$qb->delete('user_status')->executeStatement(); | |||
$qb->delete('users')->executeStatement(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dangerous if someone runs this test without a separate testing environment. this happens occasionally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it target the specific user then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good!
// IUserStatus::ONLINE, | ||
// null, | ||
// false, | ||
// ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code?
// ->method('insert'); | ||
// $this->mapper->expects($this->once()) | ||
// ->method('update') | ||
// ->with($this->callback(function ($userStatus) use ($eventStatus, $eventTimestamp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code?
{
"ocs": {
"meta": {
"status": "failure",
"statuscode": 400,
"message": ""
},
"data": []
}
} no logs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far is I can see you are changing the behavior of isUserDefined
which is a bad idea for backwards compatibility.
The OCS endpoint should not have the possibility to set it because a custom message is always set by the user.
CC @nickvergessen you know more of the internal logic here
But that is not true. The "In a call" automation sets a status that pretends to be set by the user when it is in fact not for example. |
Ok that is good to hear. I wasn't really sure what is going on just looking at the code alone. But I think the OCS endpoint still shouldn't have the option and always set it to true, do you agree? |
as far as I can tell our frontend doesn't make use of the option either. ref #41461 (comment). we should be able to revert this change. |
the frontend now does, at least if you set the status as a user in the status modal. |
the status itself i snot cached but the OOO data is. The cache is reset when an absence is created, updated or deleted as otherwise the change would never propagate. Will drop a few lines after I've made the logic changes. |
Careful with using caches as consistent storage. Let's just let the cache expire a bit earlier because it is a local one. On a clustered setup you can only clear the cache of one instance. For the other instances it has to expire on its own. You could switch to a distributed cache but they are expensive and create a new bottleneck. |
but it sets the isUserChanged to true, right? then you still don't need to expose this as setCustomMessage was already setting it to true. |
Well just because there is no option to specify this via public OCP (not S) API. But the |
@@ -192,7 +194,7 @@ public function clearMessage(): DataResponse { | |||
* 200: Status reverted | |||
*/ | |||
public function revertStatus(string $messageId): DataResponse { | |||
$backupStatus = $this->service->revertUserStatus($this->userId, $messageId, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oo this means after ending a call your user status will always be killed?
@@ -241,7 +258,7 @@ public function setPredefinedMessage(string $userId, | |||
$userStatus->setUserId($userId); | |||
$userStatus->setStatus(IUserStatus::OFFLINE); | |||
$userStatus->setStatusTimestamp(0); | |||
$userStatus->setIsUserDefined(false); | |||
$userStatus->setIsUserDefined(true); // all predefined messages are by default set by the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But offline is not settable by users, only invisible which is shown to others as "offline".
If you make Offline setIsUserDefined(true)
coming online and interacting will no longer set any status?
public const HOLIDAY_ICON = '🌴'; | ||
public const MEETING_ICON = '📅'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add @since
@@ -91,7 +94,8 @@ public function __construct(private UserStatusMapper $mapper, | |||
private IEmojiHelper $emojiHelper, | |||
private IConfig $config, | |||
private IUserManager $userManager, | |||
private CalendarStatusService $calendarStatusService) { | |||
private CalendarStatusService $calendarStatusService, | |||
public IAvailabilityCoordinator $coordinator) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public IAvailabilityCoordinator $coordinator) { | |
private IAvailabilityCoordinator $coordinator) { |
Summary
Set the user status to
DND
and the custom message to\OCA\DAV\Db\Absence::getStatus
when an absence is in effect.TODO
Checklist
Screenshots before/after for front-end changes