musician latency badge wip

This commit is contained in:
Nuwan Chathuranga 2021-05-23 18:26:21 +05:30
parent a027a75b1d
commit 8f09bdce5b
3 changed files with 55 additions and 0 deletions

View File

@ -1773,6 +1773,19 @@
});
}
function getLatencyToUsers(options) {
var id = getId(options);
var user_ids = options['user_ids'];
var data = { user_ids: user_ids };
return $.ajax({
type: "GET",
url: '/api/users/' + id + '/latencies',
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(options)
});
}
function updateAudioLatency(options) {
var id = getId(options);
return $.ajax({
@ -3204,6 +3217,7 @@
this.cancelSubscription= cancelSubscription;
this.listInvoices = listInvoices;
this.getVideoConferencingRoomUrl = getVideoConferencingRoomUrl;
this.getLatencyToUsers = getLatencyToUsers;
return this;
};
})(window, jQuery);

View File

@ -0,0 +1,6 @@
context = window
@LatencyActions = Reflux.createActions({
resolve: {}
})

View File

@ -0,0 +1,35 @@
$ = jQuery
context = window
logger = context.JK.logger
rest = new context.JK.Rest()
@LatencyStore = Reflux.createStore(
{
latencies: []
listenables: @LatencyActions
init: ->
this.listenTo(context.AppStore, this.onAppInit)
onAppInit: (@app) ->
logger.debug("LatencyStore.onAppInit")
changed: () ->
@trigger(@latencies)
onResolve: (user_ids) ->
rest.getLatencyToUsers(user_ids).done((response) => @onLoaded(response)).fail((jqXHR) => @onUserFail(jqXHR))
onLoaded: (response) ->
logger.debug("LatencyStore.onLoaded", response);
@latencies.push([{ user_id: '12345', score: 5 }])
onUserFail:(jqXHR) ->
logger.debug("LatencyStore.onFail", jqXHR);
#@app.layout.notify({title: 'Unable to Update User Info', text: "We recommend you refresh the page."})
getState:() ->
{ latencies: @latencies }
}
)