@SychO, currently the widget with my latest changes works as I wanted it, however the widget is not visible for non-admin/mods. That's actually OK for me since I needed that widget only for admin users, but for the sake of correctness, I think the reason is the following code from registerWidget.ts
:
isDisabled: () => {
const loadWithInitialResponse = app.forum.attribute('afrux-forum-widgets-core.preferDataWithInitialLoad');
return (!loadWithInitialResponse && (!app.forum.attribute('canViewLastSeenAt') || !app.forum.attribute('canSearchUsers')))
||
(loadWithInitialResponse && !app.forum.onlineUsers().length);
}
The way I understand it is that the widget will be disabled unless a user has both canViewLastSeenAt
and canSearchUsers
. I think most people wont give the canViewLastSeenAt
to non-mod users hence regular users won't see the widget.
I think what will fix it is replacing the OR with AND:
!app.forum.attribute('canViewLastSeenAt') && !app.forum.attribute('canSearchUsers'))
I changed that, however I believe I should somehow compile it, so that it goes into forum.js
, right? How is that done? I tried directly editing forum.js
(I know that's wrong but I just replaced a ||
with &&
in order to test), however I got HTTP 400, so maybe I messed it up.
Any advice? Is that change above any good, in the first place? And if yes, what's the easiest way to transpile the TS into JS?
Again, feel free to respond only when you have time 🙂