Skip to content

Commit 41b4250

Browse files
committed
chore: cleanup Togglz features.
Address to #605
1 parent 6013f08 commit 41b4250

File tree

6 files changed

+16
-58
lines changed

6 files changed

+16
-58
lines changed

src/main/java/ru/mystamps/web/feature/account/UsersActivationServiceImpl.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.springframework.transaction.annotation.Transactional;
2626
import ru.mystamps.web.common.LocaleUtils;
2727
import ru.mystamps.web.feature.site.MailService;
28-
import ru.mystamps.web.support.togglz.Features;
2928

3029
import java.util.Date;
3130
import java.util.List;
@@ -54,9 +53,7 @@ public void add(RegisterAccountDto dto, Locale lang) {
5453

5554
log.info("Users activation has been created ({})", activation);
5655

57-
if (Features.SEND_ACTIVATION_MAIL.isActive()) {
58-
mailService.sendActivationKeyToUser(new SendUsersActivationDto(activation));
59-
}
56+
mailService.sendActivationKeyToUser(new SendUsersActivationDto(activation));
6057
}
6158

6259
@Override

src/main/java/ru/mystamps/web/feature/image/ImageServiceImpl.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.springframework.web.multipart.MultipartFile;
2727
import ru.mystamps.web.feature.image.ImageDb.Images;
2828
import ru.mystamps.web.support.spring.security.HasAuthority;
29-
import ru.mystamps.web.support.togglz.Features;
3029

3130
import java.util.List;
3231
import java.util.Locale;
@@ -98,10 +97,6 @@ public ImageDto getOrCreatePreview(Integer imageId) {
9897
Validate.isTrue(imageId != null, "Image id must be non null");
9998
Validate.isTrue(imageId > 0, "Image id must be greater than zero");
10099

101-
if (!Features.SHOW_IMAGES_PREVIEW.isActive()) {
102-
return null;
103-
}
104-
105100
ImageInfoDto previewInfo = new ImageInfoDto(imageId, "jpeg");
106101

107102
// NB: the race between getPreview() and createReview() is possible.

src/main/java/ru/mystamps/web/feature/series/SeriesController.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,7 @@ public static void loadErrorsFromDownloadInterceptor(
630630
model.put("isSeriesInCollection", isSeriesInCollection);
631631
model.put("allowAddingImages", userCanAddImagesToSeries);
632632

633-
if (Features.SHOW_PURCHASES_AND_SALES.isActive()
634-
&& SecurityContextUtils.hasAuthority(Authority.VIEW_SERIES_SALES)) {
633+
if (SecurityContextUtils.hasAuthority(Authority.VIEW_SERIES_SALES)) {
635634

636635
List<PurchaseAndSaleDto> purchasesAndSales =
637636
seriesService.findPurchasesAndSales(seriesId);
@@ -647,8 +646,7 @@ public static void loadErrorsFromDownloadInterceptor(
647646
}
648647

649648
private void addSeriesSalesFormToModel(Model model) {
650-
if (!(Features.ADD_PURCHASES_AND_SALES.isActive()
651-
&& SecurityContextUtils.hasAuthority(Authority.ADD_SERIES_SALES))) {
649+
if (!SecurityContextUtils.hasAuthority(Authority.ADD_SERIES_SALES)) {
652650
return;
653651
}
654652

src/main/java/ru/mystamps/web/support/togglz/Features.java

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,10 @@
2222
import org.togglz.core.annotation.Label;
2323
import org.togglz.core.context.FeatureContext;
2424

25+
// @todo #605 Togglz: remove items left from >= 0.4.1 milestone
2526
// @todo #1022 Togglz: remove SEND_MAIL_VIA_HTTP_API from database
2627
public enum Features implements Feature {
2728

28-
@Label("/series/{id}: possibility to user to add series to collection")
29-
@EnabledByDefault
30-
ADD_SERIES_TO_COLLECTION,
31-
32-
@Label("/series/{id}: possibility of user to add additional images to series")
33-
@EnabledByDefault
34-
ADD_ADDITIONAL_IMAGES_TO_SERIES,
35-
36-
@Label("/series/{id}: show series purchases and sales")
37-
@EnabledByDefault
38-
SHOW_PURCHASES_AND_SALES,
39-
40-
@Label("/series/{id}: show images preview")
41-
@EnabledByDefault
42-
SHOW_IMAGES_PREVIEW,
43-
44-
@Label("/series/{id}: possibility of user to add series purchases and sales")
45-
@EnabledByDefault
46-
ADD_PURCHASES_AND_SALES,
47-
48-
@Label("Send mail with activation key to user")
49-
@EnabledByDefault
50-
SEND_ACTIVATION_MAIL,
51-
52-
@Label("/series/add: show link with auto-suggestions")
53-
@EnabledByDefault
54-
SHOW_SUGGESTION_LINK,
55-
5629
@Label("/site/index: search by catalog in collection")
5730
@EnabledByDefault
5831
SEARCH_IN_COLLECTION,

src/main/webapp/WEB-INF/views/series/add.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
<html lang="en" th:lang="${#locale.language == 'ru' ? 'ru' : 'en'}"
33
xmlns="http://www.w3.org/1999/xhtml"
44
xmlns:th="http://www.thymeleaf.org"
5-
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
6-
xmlns:togglz="https://github.com/heneke/thymeleaf-extras-togglz">
5+
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
76
<head>
87
<meta charset="utf-8" />
98
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -139,7 +138,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
139138
/*/-->
140139
</div>
141140

142-
<small togglz:active="SHOW_SUGGESTION_LINK">
141+
<small>
143142
<a tabindex="-1"
144143
th:text="#{t_pick_percent_name}"
145144
href="javascript:$('#js-suggest-category-link').hide(); chooseCategoryBySlug('sport'); void(0)"
@@ -180,7 +179,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
180179
/*/-->
181180
</div>
182181

183-
<small togglz:active="SHOW_SUGGESTION_LINK">
182+
<small>
184183
<a tabindex="-1"
185184
th:text="#{t_pick_percent_name}"
186185
href="javascript:$('#js-suggest-country-link').hide(); chooseCountryBySlug('russia'); void(0)"
@@ -254,7 +253,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
254253
accept="image/png,image/jpeg"
255254
th:field="*{uploadedImage}"
256255
th:attr="required=${#authorization.expression('hasAuthority(''DOWNLOAD_IMAGE'')') ? null : 'required'}" />
257-
<small togglz:active="ADD_ADDITIONAL_IMAGES_TO_SERIES" sec:authorize="hasAuthority('ADD_IMAGES_TO_SERIES')">
256+
<small sec:authorize="hasAuthority('ADD_IMAGES_TO_SERIES')">
258257
<span class="hint-block" th:text="#{t_add_more_images_hint}">
259258
Later you will be able to add additional images
260259
</span>

src/main/webapp/WEB-INF/views/series/info.html

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
<html lang="en" th:lang="${#locale.language == 'ru' ? 'ru' : 'en'}"
33
xmlns="http://www.w3.org/1999/xhtml"
44
xmlns:th="http://www.thymeleaf.org"
5-
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
6-
xmlns:togglz="https://github.com/heneke/thymeleaf-extras-togglz">
5+
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
76
<head>
87
<meta charset="utf-8" />
98
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -90,7 +89,7 @@
9089
</div>
9190
</div>
9291

93-
<div class="row" th:if="${allowAddingImages}" togglz:active="ADD_ADDITIONAL_IMAGES_TO_SERIES">
92+
<div class="row" th:if="${allowAddingImages}">
9493
<div class="col-sm-10">
9594
<form id="add-image-form"
9695
method="post"
@@ -361,7 +360,7 @@ <h5 class="text-center" th:text="#{t_similar_series}">
361360

362361
<div class="col-sm-4">
363362

364-
<div class="row" togglz:active="ADD_SERIES_TO_COLLECTION">
363+
<div class="row">
365364
<div class="col-sm-12" th:if="${not isSeriesInCollection}" sec:authorize="hasAuthority('UPDATE_COLLECTION')">
366365
<form id="add-series-form" method="post" action="../collection/info.html"
367366
th:action="@{${INFO_SERIES_PAGE}(id=${series.id})}"
@@ -458,7 +457,7 @@ <h5 class="text-center" th:text="#{t_similar_series}">
458457
/*/-->
459458
</div>
460459

461-
<div class="row" th:if="${not #lists.isEmpty(purchasesAndSales)}" togglz:active="SHOW_PURCHASES_AND_SALES" sec:authorize="hasAuthority('VIEW_SERIES_SALES')">
460+
<div class="row" th:if="${not #lists.isEmpty(purchasesAndSales)}" sec:authorize="hasAuthority('VIEW_SERIES_SALES')">
462461
<div class="col-sm-12">
463462
<h5 th:text="#{t_who_selling_series}">Who was selling/buying this series</h5>
464463
<ul th:remove="all-but-first">
@@ -512,7 +511,7 @@ <h5 th:text="#{t_who_selling_series}">Who was selling/buying this series</h5>
512511
</div>
513512
</div>
514513

515-
<div class="row" togglz:active="ADD_PURCHASES_AND_SALES" sec:authorize="hasAuthority('ADD_SERIES_SALES')">
514+
<div class="row" sec:authorize="hasAuthority('ADD_SERIES_SALES')">
516515
<div class="col-sm-12">
517516
<h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying this series</h5>
518517
<form id="add-series-sales-form"
@@ -718,10 +717,7 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
718717

719718
<!--/* @todo #995 Series sale import: add support for new sellers */-->
720719
<!--/* @todo #1057 Series sale import form: show a message when JavaScript is disabled */-->
721-
<div id="importSeriesSaleForm"
722-
togglz:active="ADD_PURCHASES_AND_SALES"
723-
sec:authorize="hasAuthority('IMPORT_SERIES_SALES')">
724-
</div>
720+
<div id="importSeriesSaleForm" sec:authorize="hasAuthority('IMPORT_SERIES_SALES')"></div>
725721

726722
</div>
727723

@@ -743,7 +739,7 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
743739
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" th:src="${BOOTSTRAP_JS}"></script>
744740

745741
<!--/*/
746-
<th:block togglz:active="SHOW_PURCHASES_AND_SALES" sec:authorize="hasAuthority('VIEW_SERIES_SALES')">
742+
<th:block sec:authorize="hasAuthority('VIEW_SERIES_SALES')">
747743
/*/-->
748744
<script src="../../../../javascript/DateUtils.js" th:src="${DATE_UTILS_JS}"></script>
749745
<script src="../../../../javascript/series/info.js" th:src="${SERIES_INFO_JS}"></script>
@@ -756,7 +752,7 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
756752
SeriesSaleImportForm uses DateUtils.formatDateToDdMmYyyy() from DateUtils.js file.
757753
*/-->
758754
<!--/*/
759-
<th:block togglz:active="ADD_PURCHASES_AND_SALES" sec:authorize="hasAuthority('IMPORT_SERIES_SALES')">
755+
<th:block sec:authorize="hasAuthority('IMPORT_SERIES_SALES')">
760756
/*/-->
761757
<script src="https://unpkg.com/[email protected]/umd/react.development.js" th:src="${REACT_JS}"></script>
762758
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js" th:src="${REACT_DOM_JS}"></script>

0 commit comments

Comments
 (0)