fix(avatar-sharing): angular@1.3.9 upgrade fixed the /#?memberId=x

bug. Also, anon wasn't able to view avatar shares!
This commit is contained in:
Tyler Renelle 2015-01-18 14:51:40 -07:00
parent 7b753e7543
commit a053486fcd
5 changed files with 14 additions and 7 deletions

View file

@ -45,10 +45,10 @@
"angular-ui-router": "~0.2.13"
},
"devDependencies": {
"angular-mocks": "1.3.3"
"angular-mocks": "1.3.9"
},
"resolutions": {
"angular": "1.3.3",
"angular": "1.3.9",
"jquery": ">=1.9.0"
}
}

View file

@ -7,8 +7,15 @@ window.habitrpg = angular.module('habitrpg', ['chieffancypants.loadingBar', 'ui.
.constant("MOBILE_APP", false)
.controller("RootCtrl", ['$scope', '$location', '$modal', '$http', function($scope, $location, $modal, $http){
// must be #?memberId=xx, see https://github.com/angular/angular.js/issues/7239
var memberId = $location.search()['memberId'];
// TODO Adding legacy support, remove this after 2/15/2015 or so
// angular@1.3.3 has bug, requires /#?memberId=x instead of ?memberId=x (https://github.com/angular/angular.js/issues/7239)
if (!memberId) {
memberId = /#\?memberId\=(.+)/.exec($location.$$absUrl);
if (memberId) memberId = memberId[memberId.length-1];
}
if (memberId) {
$http.get('/api/v2/members/'+memberId).success(function(data, status, headers, config){
$scope.profile = data;

View file

@ -309,12 +309,12 @@ api.flagChatMessage = function(req, res, next){
{name: "REPORTER_USERNAME", content: user.profile.name},
{name: "REPORTER_UUID", content: user._id},
{name: "REPORTER_EMAIL", content: user.auth.local ? user.auth.local.email : ((user.auth.facebook && user.auth.facebook.emails && user.auth.facebook.emails[0]) ? user.auth.facebook.emails[0].value : null)},
{name: "REPORTER_MODAL_URL", content: "https://habitrpg.com/static/front/#?memberId=" + user._id},
{name: "REPORTER_MODAL_URL", content: "https://habitrpg.com/static/front?memberId=" + user._id},
{name: "AUTHOR_USERNAME", content: message.user},
{name: "AUTHOR_UUID", content: message.uuid},
{name: "AUTHOR_EMAIL", content: author.auth.local ? author.auth.local.email : ((author.auth.facebook && author.auth.facebook.emails && author.auth.facebook.emails[0]) ? author.auth.facebook.emails[0].value : null)},
{name: "AUTHOR_MODAL_URL", content: "https://habitrpg.com/static/front/#?memberId=" + message.uuid},
{name: "AUTHOR_MODAL_URL", content: "https://habitrpg.com/static/front?memberId=" + message.uuid},
{name: "GROUP_NAME", content: group.name},
{name: "GROUP_TYPE", content: group.type},

View file

@ -607,7 +607,7 @@ module.exports = (swagger, v2) ->
path: '/members/{uuid}'
description: "Get a member."
parameters: [path('uuid','Member ID','string')]
middleware: [auth.auth, i18n.getUserLanguage]
middleware: [i18n.getUserLanguage] # removed auth.auth, so anon users can view shared avatars
action: members.getMember
"/members/{uuid}/message":
spec:

View file

@ -7,7 +7,7 @@ mixin avatar(opts)
.character-sprites
.addthis_native_toolbox(ng-if='profile._id==user._id', data-url="#{env.BASE_URL}/static/front/#?memberId={{profile._id}}", data-title="Check out my HabitRPG progress!")
.addthis_native_toolbox(ng-if='profile._id==user._id', data-url="#{env.BASE_URL}/static/front?memberId={{profile._id}}", data-title="Check out my HabitRPG progress!")
// Mount Body
if !opts.minimal