Skip to content

Commit

Permalink
NTI-10688 - remove more dead flags
Browse files Browse the repository at this point in the history
migrate all isFeature => isFlag
  • Loading branch information
jsg2021 committed Aug 23, 2021
1 parent 8feee96 commit 67e2f60
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 107 deletions.
9 changes: 1 addition & 8 deletions config/service.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@
],

"flags": {
"analytic-reports": true,
"badges": true,
"course-content-modal": true,
"instructor-email": true,
"request-alias-change": true,
"suggest-contacts": false,
"use-new-search": true,
"use-new-user-list": true,
"show-create-ltitool-button": true
"suggest-contacts": false
}
}
}
19 changes: 0 additions & 19 deletions src/main/js/legacy/app/account/settings/components/Preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,6 @@ module.exports = exports = Ext.define(
],
},
},
{
tag: 'tpl',
if: "isFeature('badges')",
cn: {
tag: 'fieldset',
cn: [
{ tag: 'legend', html: 'Badges' },
{
tag: 'span',
cls: 'not-ready nti-checkbox course-badges',
html: 'Make badges earned for completing a course public.',
tabIndex: 0,
role: 'button',
'data-preference-path': 'Badges/Course',
'data-preference-key': 'show_course_badges',
},
],
},
},
]),

afterRender: function () {
Expand Down
20 changes: 1 addition & 19 deletions src/main/js/legacy/app/badge/components/Footer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const Ext = require('@nti/extjs');
const { isFeature } = require('internal/legacy/util/Globals');

module.exports = exports = Ext.define(
'NextThought.app.badge.components.Footer',
Expand All @@ -12,36 +11,19 @@ module.exports = exports = Ext.define(
renderTpl: Ext.DomHelper.markup([
{
cls: 'left',
cn: [
{
cls: 'btn export',
'data-qtip': 'Download or Export Badge',
},
],
cn: [],
},
{ cls: 'right', cn: [{ cls: 'btn close', html: 'Close' }] },
]),

renderSelectors: {
exportEl: '.export',
closeEl: '.close',
},

afterRender: function () {
this.callParent(arguments);

this.mon(this.exportEl, 'click', this.onExportClick.bind(this));
this.mon(this.closeEl, 'click', this.onCloseClick.bind(this));

if (!isFeature('badges')) {
this.exportEl.hide();
}
},

onExportClick: function (e) {
if (this.onExport) {
this.onExport(e);
}
},

onCloseClick: function (e) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/js/legacy/app/contacts/components/outline/View.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Ext = require('@nti/extjs');
const { wait } = require('@nti/lib-commons');
const { isFeature } = require('internal/legacy/util/Globals');
const { isFlag } = require('@nti/web-client');

const ContactsActions = require('../../Actions');

Expand Down Expand Up @@ -149,7 +149,7 @@ module.exports = exports = Ext.define(
canjoin: this.subType === 'group',
isContact: this.subType === 'contact',
suggestedContactsLabel:
isFeature('suggest-contacts') &&
isFlag('suggest-contacts') &&
this.subType === 'contact' &&
'Suggested Contacts',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ const Ext = require('@nti/extjs');
const { ControlBar, NavigationBar } = require('@nti/web-assignment-editor');
const { encodeForURI } = require('@nti/lib-ntiids');
const { scoped } = require('@nti/lib-locale');
const { isFlag } = require('@nti/web-client');
const ChatStateStore = require('internal/legacy/app/chat/StateStore');
const AssignmentStatus = require('internal/legacy/app/course/assessment/AssignmentStatus');
const WindowsActions = require('internal/legacy/app/windows/Actions');
const Grade = require('internal/legacy/model/courseware/Grade');
const Email = require('internal/legacy/model/Email');
const ReactHarness = require('internal/legacy/overrides/ReactHarness');
const { isFeature } = require('internal/legacy/util/Globals');
const lazy = require('internal/legacy/util/lazy-require').get(
'ParseUtils',
() => require('internal/legacy/util/Parsing')
Expand Down Expand Up @@ -333,7 +333,7 @@ module.exports = exports = Ext.define(
})
);

if (!isFeature('instructor-email') || !username) {
if (!isFlag('instructor-email') || !username) {
return Promise.reject();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const Ext = require('@nti/extjs');
const { wait } = require('@nti/lib-commons');
const { scoped } = require('@nti/lib-locale');
const { isFlag } = require('@nti/web-client');
const { getString } = require('internal/legacy/util/Localization');
const Email = require('internal/legacy/model/Email');
const { isFeature } = require('internal/legacy/util/Globals');

const WindowsActions = require('../../../../windows/Actions');
const WindowsStateStore = require('../../../../windows/StateStore');
Expand Down Expand Up @@ -366,7 +366,7 @@ module.exports = exports = Ext.define(
},

shouldAllowInstructorEmail: function () {
return isFeature('instructor-email');
return isFlag('instructor-email');
},

showEmailEditor: function (e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const Ext = require('@nti/extjs');
const { Viewer } = require('@nti/web-reports');
const { isFeature } = require('internal/legacy/util/Globals');

require('../../student/assignments/ListItem');

Expand Down Expand Up @@ -76,9 +75,7 @@ module.exports = exports = Ext.define(
submittedCount: totalSubmissions || 0,
totalPossibleSubmissions,
hasReports:
item.get('reportLinks') &&
item.get('reportLinks').length &&
isFeature('analytic-reports'),
item.get('reportLinks') && item.get('reportLinks').length,
canEdit: item.get('canEdit'),
name: assignment.get('title'),
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const Ext = require('@nti/extjs');
const { isFlag } = require('@nti/web-client');
const UserRepository = require('internal/legacy/cache/UserRepository');
const User = require('internal/legacy/model/User');
const lazy = require('internal/legacy/util/lazy-require').get(
'ParseUtils',
() => require('internal/legacy/util/Parsing')
);
const PagedPageSource = require('internal/legacy/util/PagedPageSource');
const { isFeature } = require('internal/legacy/util/Globals');

require('./Root');
require('./Student');
Expand Down Expand Up @@ -217,7 +217,7 @@ module.exports = exports = Ext.define(
})
);

if (!isFeature('instructor-email') || !username) {
if (!isFlag('instructor-email') || !username) {
return Promise.reject();
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/js/legacy/app/course/catalog/TabPanel.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const Ext = require('@nti/extjs');
const { wait } = require('@nti/lib-commons');
const { isFlag } = require('@nti/web-client');
const User = require('internal/legacy/model/User');
const { getString } = require('internal/legacy/util/Localization');
const { isFeature } = require('internal/legacy/util/Globals');

module.exports = exports = Ext.define(
'NextThought.app.course.catalog.TabPanel',
Expand Down Expand Up @@ -130,7 +130,7 @@ module.exports = exports = Ext.define(

if (
$AppConfig.userObject.hasLink('first_time_logon') &&
isFeature('suggest-contacts')
isFlag('suggest-contacts')
) {
wait().then(function () {
me.showWelcomeMessage();
Expand Down
9 changes: 5 additions & 4 deletions src/main/js/legacy/app/course/enrollment/Details.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ const { wait } = require('@nti/lib-commons');
const { Presentation: PresentationAssets } = require('@nti/web-commons');
const { Enrollment } = require('@nti/web-course');
const { encodeForURI } = require('@nti/lib-ntiids');
const { isFlag } = require('@nti/web-client');
const User = require('internal/legacy/model/User');
const {
getString,
getFormattedString,
} = require('internal/legacy/util/Localization');
const AnalyticsUtil = require('internal/legacy/util/Analytics');
const { guidGenerator, isFeature } = require('internal/legacy/util/Globals');
const { guidGenerator } = require('internal/legacy/util/Globals');
const NavigationActions = require('internal/legacy/app/navigation/Actions');
const AccountActions = require('internal/legacy/app/account/Actions');
const CoursesStateStore = require('internal/legacy/app/library/courses/StateStore');
Expand Down Expand Up @@ -259,7 +260,7 @@ module.exports = exports = Ext.define(

this.enableBubble(['enrolled-action', 'show-msg', 'go-back']);

this.useReactEnrollment = true; //isFeature('use-new-enrollment-card');
this.useReactEnrollment = true;

AnalyticsUtil.startEvent(this.course.getId(), {
type: 'CourseCatalogView',
Expand Down Expand Up @@ -1270,7 +1271,7 @@ module.exports = exports = Ext.define(
action
.then(function (changed) {
// TODO: We're not ready to show this yet.
if (isFeature('suggest-contacts')) {
if (isFlag('suggest-contacts')) {
me.__buildCongratsCard();
}
return changed;
Expand Down Expand Up @@ -1299,7 +1300,7 @@ module.exports = exports = Ext.define(
});
};

if (!isFeature('suggest-contacts')) {
if (!isFlag('suggest-contacts')) {
me.showMessage(
getFormattedString(
'NextThought.view.courseware.enrollment.Details.enrollmentSuccess',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { Viewer } = require('@nti/web-reports');
const WindowsActions = require('internal/legacy/app/windows/Actions');
const UserRepository = require('internal/legacy/cache/UserRepository');
const CommunityHeadlineTopic = require('internal/legacy/model/forums/CommunityHeadlineTopic');
const { isFeature, WAIT_TIMES } = require('internal/legacy/util/Globals');
const { WAIT_TIMES } = require('internal/legacy/util/Globals');
const { getString } = require('internal/legacy/util/Localization');
const TimeUtils = require('internal/legacy/util/Time');

Expand Down Expand Up @@ -145,16 +145,14 @@ module.exports = exports = Ext.define(
showReport: function (value) {
var show = false;

if (isFeature('analytic-reports')) {
((value.Links && value.Links.asJSON()) || []).forEach(
function (link) {
if (link.rel.indexOf('report-') >= 0) {
show = true;
return false;
}
((value.Links && value.Links.asJSON()) || []).forEach(
function (link) {
if (link.rel.indexOf('report-') >= 0) {
show = true;
return false;
}
);
}
}
);

return show;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const Ext = require('@nti/extjs');
const { wait } = require('@nti/lib-commons');
const { isFlag } = require('@nti/web-client');
const LibraryActions = require('internal/legacy/app/library/Actions');
const CoursesActions = require('internal/legacy/app/library/courses/Actions');
const User = require('internal/legacy/model/User');
const { isFeature } = require('internal/legacy/util/Globals');
const {
getString,
getFormattedString,
Expand Down Expand Up @@ -87,7 +87,7 @@ module.exports = exports = Ext.define(

if (
$AppConfig.userObject.hasLink('first_time_logon') &&
isFeature('suggest-contacts')
isFlag('suggest-contacts')
) {
wait().then(function () {
me.showWelcomeMessage();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/*eslint no-undef:1*/

const { getService } = require('@nti/web-client');
const { getService, isFlag } = require('@nti/web-client');
const Ext = require('@nti/extjs');
const { encodeForURI, decodeFromURI } = require('@nti/lib-ntiids');
const { wait } = require('@nti/lib-commons');
const EnrollmentActions = require('internal/legacy/app/course/enrollment/Actions');
const EnrollmentStateStore = require('internal/legacy/app/course/enrollment/StateStore');
const StoreActions = require('internal/legacy/app/store/Actions');
const { isFeature } = require('internal/legacy/util/Globals');
const { getString } = require('internal/legacy/util/Localization');

const CoursesActions = require('../../Actions');
Expand Down Expand Up @@ -347,7 +346,7 @@ module.exports = exports = Ext.define(
// For first time login, remove the login link to avoid presenting the user with OOBE again.
if (
$AppConfig.userObject.hasLink('first_time_logon') &&
isFeature('suggest-contacts')
isFlag('suggest-contacts')
) {
$AppConfig.userObject.removeFirstTimeLoginLink();
}
Expand Down
18 changes: 0 additions & 18 deletions src/main/js/legacy/app/navigation/path/parts/Profiles.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const Ext = require('@nti/extjs');
const { isFeature } = require('internal/legacy/util/Globals');
const User = require('internal/legacy/model/User');
const Badge = require('internal/legacy/model/openbadges/Badge');
const DynamicFriendsList = require('internal/legacy/model/DynamicFriendsList');
const lazy = require('internal/legacy/util/lazy-require').get(
'ContextStateStore',
Expand All @@ -19,10 +17,6 @@ module.exports = exports = Ext.define(

addHandlers: function (handlers) {
handlers[User.mimeType] = this.getPathToUser.bind(this);
handlers[Badge.mimeType] = {
doNotCache: true,
fn: this.getPathToBadge.bind(this),
};
handlers[DynamicFriendsList.mimeType] =
this.getPathToDynamicFriendsList.bind(this);

Expand All @@ -33,18 +27,6 @@ module.exports = exports = Ext.define(
return Promise.resolve([user]);
},

getPathToBadge: function (badge, getPathTo) {
var user = badge.targetUser || $AppConfig.userObject;

return getPathTo(user).then(function (path) {
if (isFeature('badges')) {
path.push('achievements', badge);
}

return path;
});
},

getPathToDynamicFriendsList: function (dfl) {
return Promise.resolve([dfl]);
},
Expand Down
3 changes: 2 additions & 1 deletion src/main/js/legacy/model/User.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const Ext = require('@nti/extjs');
const { isFlag } = require('@nti/web-client');
const { getString } = require('internal/legacy/util/Localization');
const B64 = require('internal/legacy/util/Base64');
const Globals = require('internal/legacy/util/Globals');
Expand Down Expand Up @@ -544,7 +545,7 @@ const User =

getSuggestContacts: function () {
if (
!Globals.isFeature('suggest-contacts') ||
!isFlag('suggest-contacts') ||
!(
this.hasLink('SuggestContacts') ||
this.hasLink('Classmates')
Expand Down
Loading

0 comments on commit 67e2f60

Please sign in to comment.