mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
* pull apart achievements into different subcategories
* achievs previously hidden to others if unachieved are now always shown
* achievs previously always hidden if unachieved are now always shown
* pull apart ultimate gear achievs
* add achiev wrapper mixin
* add achiev mixin for simple counts
* add achiev mixin for singular/plural achievs
* add simpleAchiev mixin and support attributes
* always hide potentially unearnable achievs if unearned
* contributor achiev now uses string interpolation for readMore link
* transition to basic achiev grid layout
* fix npc achievement img bug introduced in c90f7e2
* move surveys and contributor achievs into special section so it is never empty
* double size of achievs in achievs grid
* achievs in grid are muted if unachieved (includes recompiled sprites)
* fix streak notification strings
* add counts to achievement badges for applicable achieved achievs
* list achievements by api
* fix achievement strings in new api
* unearned achievs now use dedicated (WIP) 'unearned' badge instead of muted versions of the normal badges
* fix & cleanup achievements api
* extract generation of the achievements result to a class
* clean up achievement counter css using existing classes
* simplify exports of new achievementBuilder lib
* remove class logic from achievementBuilder lib
* move achievs to common, add rebirth achiev logic, misc fixes
* replace achievs jade logic with results of api call
* fix linting errors
* achievs lib now returns achievs object subdivided by type (basic/seasonal/special
* add tests for new achievs lib
* fix linting errors
* update controllers and views for updated achievs lib
* add indices to achievements to preserve intended order
* move achiev popovers to left
* rename achievs lib to achievements
* adjust positioning of achieve popovers now that stats and achievs pages
are separate
* fix: achievements api correctly decides whether to append extra string for master and triadBingo achievs
* revert compiled sprites so they don't bog down the PR
* pull out achievs api integration tests
* parameterize ultimate gear achievements' text string
* break out static achievement data from user-specific data
* reorg content.achievements to add achiev data in related chunks
* cleanup, respond to feedback
* improve api documentation
* fix merge issues
* Helped Habit Grow --> Helped Habitica Grow
* achievement popovers are muted if the achiev is unearned
* fix singular achievement labels / achievement popover on click
* update apidoc for achievements (description, param-type, successExample, error-types)
* fix whitespace issues in members.js
* move html to a variable
* updated json example
* fix syntax after merge
85 lines
2.9 KiB
JavaScript
85 lines
2.9 KiB
JavaScript
"use strict";
|
|
|
|
habitrpg
|
|
.controller("MemberModalCtrl", ['$scope', '$rootScope', 'Members', 'Shared', '$http', 'Notification', 'Groups', 'Chat', '$controller', 'Stats', 'Costume',
|
|
function($scope, $rootScope, Members, Shared, $http, Notification, Groups, Chat, $controller, Stats, Costume) {
|
|
|
|
$controller('RootCtrl', {$scope: $scope});
|
|
$rootScope.appLoaded = true;
|
|
|
|
$scope.timestamp = function(timestamp){
|
|
return moment(timestamp).format($rootScope.User.user.preferences.dateFormat.toUpperCase());
|
|
}
|
|
|
|
$scope.statCalc = Stats;
|
|
|
|
// We watch Members.selectedMember because it's asynchronously set, so would be a hassle to handle updates here
|
|
$scope.$watch( function() { return Members.selectedMember; }, function (member) {
|
|
if(member) {
|
|
$scope.profile = member;
|
|
|
|
$scope.achievements = Shared.achievements.getAchievementsForProfile($scope.profile);
|
|
$scope.achievPopoverPlacement = 'left';
|
|
$scope.achievAppendToBody = 'false'; // append-to-body breaks popovers in modal windows
|
|
}
|
|
});
|
|
|
|
$scope.costume = Costume;
|
|
|
|
$scope.keyDownListener = function (e) {
|
|
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
|
$scope.sendPrivateMessage($scope.profile._id, $scope._message);
|
|
}
|
|
};
|
|
|
|
|
|
$scope.sendPrivateMessage = function(uuid, message){
|
|
if (!message) return;
|
|
|
|
Members.sendPrivateMessage(message, uuid)
|
|
.then(function (response) {
|
|
Notification.text(window.env.t('messageSentAlert'));
|
|
$rootScope.User.sync();
|
|
$scope.$close();
|
|
});
|
|
};
|
|
|
|
//@TODO: We don't send subscriptions so the structure has changed in the back. Update this when we update the views.
|
|
$scope.gift = {
|
|
type: 'gems',
|
|
gems: {amount: 0, fromBalance: true},
|
|
subscription: {key: ''},
|
|
message: ''
|
|
};
|
|
|
|
$scope.sendGift = function (uuid) {
|
|
Members.transferGems($scope.gift.message, uuid, $scope.gift.gems.amount)
|
|
.then(function (response) {
|
|
Notification.text(window.env.t('sentGems'));
|
|
$rootScope.User.sync();
|
|
$scope.$close();
|
|
});
|
|
};
|
|
|
|
$scope.reportAbuse = function(reporter, message, groupId) {
|
|
Chat.flagChatMessage(groupId, message.id)
|
|
.then(function(data){
|
|
var res = data.data.data;
|
|
message.flags = res.flags;
|
|
message.flagCount = res.flagCount;
|
|
Notification.text(window.env.t('abuseReported'));
|
|
$scope.$close();
|
|
});
|
|
};
|
|
|
|
$scope.clearFlagCount = function(message, groupId) {
|
|
Chat.clearFlagCount(groupId, message.id)
|
|
.then(function(data){
|
|
message.flagCount = 0;
|
|
Notification.text("Flags cleared");
|
|
$scope.$close();
|
|
});
|
|
}
|
|
}
|
|
]);
|