This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/routes/discourse_restricted_user_route.js
Robin Ward 80fd714b23 FIX: Use replaceWith instead of transitionTo when redirecting to a
user's activity. That way the back button works nicely. Also we can now
shorten a lot of links that were going to activity instead.
2014-06-03 10:47:21 -04:00

21 lines
389 B
JavaScript

/**
A base route that allows us to redirect when access is restricted
@class RestrictedUserRoute
@extends Discourse.Route
@namespace Discourse
@module Discourse
**/
Discourse.RestrictedUserRoute = Discourse.Route.extend({
afterModel: function() {
var user = this.modelFor('user');
if (!user.get('can_edit')) {
this.replaceWith('userActivity');
}
}
});