Skip to content

Commit

Permalink
#2585 User colors now change again for everyone when someone changes …
Browse files Browse the repository at this point in the history
…it. Overflow now also shows the correct color for the user.
  • Loading branch information
Wotuu committed Nov 11, 2024
1 parent ec94115 commit 50c282e
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 7 deletions.
6 changes: 6 additions & 0 deletions database/seeders/dungeondata/mapping_commit_logs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2494,5 +2494,11 @@
"merged": 0,
"created_at": "2024-11-03T10:10:08.000000Z",
"updated_at": "2024-11-03T10:10:08.000000Z"
},
{
"id": 417,
"merged": 0,
"created_at": "2024-11-06T14:15:12.000000Z",
"updated_at": "2024-11-06T14:15:12.000000Z"
}
]
2 changes: 1 addition & 1 deletion resources/assets/js/custom/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ let c = {
}
},
echo: {
tooltipFadeOutTimeout: 3000,
tooltipFadeOutTimeoutMs: 3000,
// The amount of time that must pass before another mouse location is saved to be synced to others, in milliseconds
mousePollFrequencyMs: 100,
// How often to send the mouse frequency, in milliseconds
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/custom/echo/echo.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Echo extends Signalable {
new PathDeletedHandler(this),

// Color changed
// new ColorChangedHandler(this),
new UserColorChangedHandler(this),

// Whisper handlers
new MousePositionHandler(this),
Expand Down
11 changes: 11 additions & 0 deletions resources/assets/js/custom/echo/message/listen/usercolorchanged.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

/**
* @property {String} model_class
* @property {Object} model
* @property {string} color
*/
class UserColorChangedMessage extends ModelMessage {
static getName() {
return 'user-color-changed';
}
}
5 changes: 5 additions & 0 deletions resources/assets/js/custom/echo/message/messagefactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class MessageFactory {
result = new PathDeletedMessage(props);
break;

// Color changed
case UserColorChangedMessage.getName():
result = new UserColorChangedMessage(props);
break;

// LiveSession
case LiveSessionInviteMessage.getName():
result = new LiveSessionInviteMessage(props);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ColorChangedHandler extends MessageHandler {
class UserColorChangedHandler extends MessageHandler {

constructor(echo) {
super(echo, '.user-color-changed');
Expand All @@ -10,4 +10,4 @@ class ColorChangedHandler extends MessageHandler {

this.echo.setUserColorByPublicKey(e.user.public_key, e.color);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
{{/unless}}
{{/ifCond}}
<a class="dropdown-item" href="{{url}}" target="_blank">
<i class="fas fa-user"></i> {{../connected_user_view_profile_label}}
<i class="fas fa-user" style="color: {{color}};"></i> {{../connected_user_view_profile_label}}
</a>
</div>
</div>
Expand All @@ -67,7 +67,7 @@
<div class="dropdown-menu" aria-labelledby="edit_route_echo_members_overflow_dropdown">
{{#each usersOverflow}}
<a class="dropdown-item" href="{{url}}" target="_blank">
<i class="fas fa-user"></i> {{initials}}
<i class="fas fa-user" style="color: {{color}};"></i> {{initials}}
</a>
{{/each}}
</div>
Expand Down
3 changes: 2 additions & 1 deletion webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,13 @@ let scripts = [
'resources/assets/js/custom/echo/message/listen/models/overpulledenemy/deleted.js',
'resources/assets/js/custom/echo/message/listen/models/path/changed.js',
'resources/assets/js/custom/echo/message/listen/models/path/deleted.js',
'resources/assets/js/custom/echo/message/listen/usercolorchanged.js',
'resources/assets/js/custom/echo/message/whisper/viewport.js',
'resources/assets/js/custom/echo/message/whisper/mouseposition.js',
'resources/assets/js/custom/echo/message/messagefactory.js',

// Echo message handlers
'resources/assets/js/custom/echo/messagehandler/messagehandler.js',
'resources/assets/js/custom/echo/messagehandler/listen/colorchanged.js',
'resources/assets/js/custom/echo/messagehandler/listen/livesession/invite.js',
'resources/assets/js/custom/echo/messagehandler/listen/livesession/stop.js',
'resources/assets/js/custom/echo/messagehandler/listen/models/basemodelhandler.js',
Expand All @@ -209,6 +209,7 @@ let scripts = [
'resources/assets/js/custom/echo/messagehandler/listen/models/overpulledenemy/deleted.js',
'resources/assets/js/custom/echo/messagehandler/listen/models/path/changed.js',
'resources/assets/js/custom/echo/messagehandler/listen/models/path/deleted.js',
'resources/assets/js/custom/echo/messagehandler/listen/usercolorchanged.js',
'resources/assets/js/custom/echo/messagehandler/whisper/whispermessagehandler.js',
'resources/assets/js/custom/echo/messagehandler/whisper/viewport.js',
'resources/assets/js/custom/echo/messagehandler/whisper/mouseposition.js',
Expand Down

0 comments on commit 50c282e

Please sign in to comment.