mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-52339] Top playbooks missing from insights (#23076)
Automatic Merge
This commit is contained in:
parent
9e3f6e1840
commit
3995f4a724
@ -0,0 +1,48 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
// ***************************************************************
|
||||
// - [#] indicates a test step (e.g. # Go to a page)
|
||||
// - [*] indicates an assertion (e.g. * Check the title)
|
||||
// - Use element ID when selecting an element. Create one if none.
|
||||
// ***************************************************************
|
||||
// Stage: @prod
|
||||
|
||||
describe('Insights', () => {
|
||||
let teamA;
|
||||
|
||||
before(() => {
|
||||
cy.shouldHaveFeatureFlag('InsightsEnabled', true);
|
||||
|
||||
cy.apiInitSetup().then(({team}) => {
|
||||
teamA = team;
|
||||
});
|
||||
});
|
||||
it('Check all the cards exist', () => {
|
||||
cy.apiAdminLogin();
|
||||
|
||||
// # Go to the Insights view
|
||||
cy.visit(`/${teamA.name}/activity-and-insights`);
|
||||
|
||||
// * Check top channels exists
|
||||
cy.get('.top-channels-card').should('exist');
|
||||
|
||||
// * Check top threads exists
|
||||
cy.get('.top-threads-card').should('exist');
|
||||
|
||||
// * Check top boards exists because product mode is enabled
|
||||
cy.get('.top-boards-card').should('exist');
|
||||
|
||||
// * Check top reactions exists
|
||||
cy.get('.top-reactions-card').should('exist');
|
||||
|
||||
// * Check top dms exists
|
||||
cy.get('.top-dms-card').should('exist');
|
||||
|
||||
// * Check least active channels exists
|
||||
cy.get('.least-active-channels-card').should('exist');
|
||||
|
||||
// * Check top playbooks exists because product mode is enabled
|
||||
cy.get('.top-playbooks-card').should('exist');
|
||||
});
|
||||
});
|
@ -10,14 +10,12 @@ import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/mattermost/mattermost-server/server/v8/model"
|
||||
"github.com/mattermost/mattermost-server/server/v8/playbooks/server/app"
|
||||
"github.com/mattermost/mattermost-server/server/v8/playbooks/server/config"
|
||||
"github.com/mattermost/mattermost-server/server/v8/playbooks/server/playbooks"
|
||||
"github.com/mattermost/mattermost-server/server/v8/playbooks/server/timeutils"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
@ -693,14 +691,8 @@ func (h *PlaybookHandler) getTopPlaybooksForUser(c *Context, w http.ResponseWrit
|
||||
h.HandleErrorWithCode(w, c.logger, http.StatusBadRequest, "unable to get user", err)
|
||||
return
|
||||
}
|
||||
timezone, err := timeutils.GetUserTimezone(user)
|
||||
if err != nil {
|
||||
h.HandleErrorWithCode(w, c.logger, http.StatusBadRequest, "unable to get user timezone", err)
|
||||
return
|
||||
}
|
||||
if timezone == nil {
|
||||
timezone = time.Now().UTC().Location()
|
||||
}
|
||||
timezone := user.GetTimezoneLocation()
|
||||
|
||||
// get unix time for duration
|
||||
startTime, appErr := model.GetStartOfDayForTimeRange(timeRange, timezone)
|
||||
if appErr != nil {
|
||||
@ -750,14 +742,8 @@ func (h *PlaybookHandler) getTopPlaybooksForTeam(c *Context, w http.ResponseWrit
|
||||
h.HandleErrorWithCode(w, c.logger, http.StatusBadRequest, "unable to get user", err)
|
||||
return
|
||||
}
|
||||
timezone, err := timeutils.GetUserTimezone(user)
|
||||
if err != nil {
|
||||
h.HandleErrorWithCode(w, c.logger, http.StatusBadRequest, "unable to get user timezone", err)
|
||||
return
|
||||
}
|
||||
if timezone == nil {
|
||||
timezone = time.Now().UTC().Location()
|
||||
}
|
||||
timezone := user.GetTimezoneLocation()
|
||||
|
||||
// get unix time for duration
|
||||
startTime, appErr := model.GetStartOfDayForTimeRange(timeRange, timezone)
|
||||
if appErr != nil {
|
||||
|
@ -16,7 +16,6 @@ import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
||||
|
||||
import {selectLhsItem} from 'actions/views/lhs';
|
||||
import {GlobalState} from 'types/store';
|
||||
import {LhsItemType, LhsPage} from 'types/store/lhs';
|
||||
|
||||
import {CardSizes, InsightsWidgetTypes, TimeFrame, TimeFrames} from '@mattermost/types/insights';
|
||||
@ -41,17 +40,20 @@ type SelectOption = {
|
||||
|
||||
const Insights = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
// check if either of focalboard plugin or boards product is enabled
|
||||
const focalboardPluginEnabled = useSelector((state: GlobalState) => state.plugins.plugins?.focalboard);
|
||||
let focalboardProductEnabled = false;
|
||||
const products = useProducts();
|
||||
if (products) {
|
||||
focalboardProductEnabled = products.some((product) => product.pluginId === suitePluginIds.focalboard || product.pluginId === suitePluginIds.boards);
|
||||
}
|
||||
const focalboardEnabled = focalboardPluginEnabled || focalboardProductEnabled;
|
||||
|
||||
const playbooksEnabled = useSelector((state: GlobalState) => state.plugins.plugins?.playbooks);
|
||||
let focalboardEnabled = false;
|
||||
let playbooksEnabled = false;
|
||||
if (products) {
|
||||
products.forEach((product) => {
|
||||
if (product.pluginId === suitePluginIds.boards) {
|
||||
focalboardEnabled = true;
|
||||
} else if (product.pluginId === suitePluginIds.playbooks) {
|
||||
playbooksEnabled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const currentUserId = useSelector(getCurrentUserId);
|
||||
const currentTeamId = useSelector(getCurrentTeamId);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user