FIX: Add traffic info footer to the new /about page (#28779)

This commit adds the traffic info footer that currently exists on the old /about page to the new one.
This commit is contained in:
Osama Sayegh 2024-09-06 15:05:46 +03:00 committed by GitHub
parent 4cefbf8704
commit d642020b0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 0 deletions

View File

@ -170,6 +170,13 @@ export default class AboutPage extends Component {
} }
} }
get trafficInfoFooter() {
return I18n.messageFormat("about.traffic_info_footer_MF", {
total_visitors: this.args.model.stats.visitors_30_days,
eu_visitors: this.args.model.stats.eu_visitors_30_days,
});
}
siteActivitiesFromPlugins() { siteActivitiesFromPlugins() {
const stats = this.args.model.stats; const stats = this.args.model.stats;
const statKeys = Object.keys(stats); const statKeys = Object.keys(stats);
@ -283,6 +290,10 @@ export default class AboutPage extends Component {
</div> </div>
{{/each}} {{/each}}
</div> </div>
{{#if this.siteSettings.display_eu_visitor_stats}}
<p class="about traffic-info-footer"><small
>{{this.trafficInfoFooter}}</small></p>
{{/if}}
</div> </div>
</div> </div>
</template> </template>

View File

@ -202,6 +202,24 @@ describe "About page", type: :system do
expect(about_page.site_activities.likes).to have_all_time_period expect(about_page.site_activities.likes).to have_all_time_period
end end
end end
describe "traffic info footer" do
it "is displayed when the display_eu_visitor_stats setting is true" do
SiteSetting.display_eu_visitor_stats = true
about_page.visit
expect(about_page).to have_traffic_info_footer
end
it "is not displayed when the display_eu_visitor_stats setting is false" do
SiteSetting.display_eu_visitor_stats = false
about_page.visit
expect(about_page).to have_no_traffic_info_footer
end
end
end end
describe "our admins section" do describe "our admins section" do

View File

@ -62,6 +62,14 @@ module PageObjects
has_no_css?(".edit-about-page") has_no_css?(".edit-about-page")
end end
def has_traffic_info_footer?
has_css?(".traffic-info-footer")
end
def has_no_traffic_info_footer?
has_no_css?(".traffic-info-footer")
end
def site_activities def site_activities
PageObjects::Components::AboutPageSiteActivity.new(find(".about__activities")) PageObjects::Components::AboutPageSiteActivity.new(find(".about__activities"))
end end