mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
added window title for scheduled post tab and fixed draft alignment (#30179)
* added window title for scheduled post tab and fixed draft alignment * i18n fix
This commit is contained in:
parent
4a44d23095
commit
83ec1d9f7d
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
&__main {
|
&__main {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
top: 56px;
|
||||||
display: flex;
|
display: flex;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -68,6 +69,10 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.DraftList.Drafts__main {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ function mapStateToProps(state: GlobalState, {location: {pathname}}: Props) {
|
|||||||
unreadStatus: getUnreadStatus(state),
|
unreadStatus: getUnreadStatus(state),
|
||||||
inGlobalThreads: matchPath(pathname, {path: '/:team/threads/:threadIdentifier?'}) != null,
|
inGlobalThreads: matchPath(pathname, {path: '/:team/threads/:threadIdentifier?'}) != null,
|
||||||
inDrafts: matchPath(pathname, {path: '/:team/drafts'}) != null,
|
inDrafts: matchPath(pathname, {path: '/:team/drafts'}) != null,
|
||||||
|
inScheduledPosts: matchPath(pathname, {path: '/:team/scheduled_posts'}) != null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ describe('components/UnreadsStatusHandler', () => {
|
|||||||
currentTeammate: null,
|
currentTeammate: null,
|
||||||
inGlobalThreads: false,
|
inGlobalThreads: false,
|
||||||
inDrafts: false,
|
inDrafts: false,
|
||||||
|
inScheduledPosts: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
test('set correctly the title when needed', () => {
|
test('set correctly the title when needed', () => {
|
||||||
@ -83,6 +84,38 @@ describe('components/UnreadsStatusHandler', () => {
|
|||||||
currentTeammate: {} as Props['currentTeammate']});
|
currentTeammate: {} as Props['currentTeammate']});
|
||||||
instance.updateTitle();
|
instance.updateTitle();
|
||||||
expect(document.title).toBe('Mattermost - Join a team');
|
expect(document.title).toBe('Mattermost - Join a team');
|
||||||
|
|
||||||
|
wrapper.setProps({
|
||||||
|
inDrafts: false,
|
||||||
|
inScheduledPosts: true,
|
||||||
|
unreadStatus: 0,
|
||||||
|
});
|
||||||
|
instance.updateTitle();
|
||||||
|
expect(document.title).toBe('Scheduled - Test team display name');
|
||||||
|
|
||||||
|
wrapper.setProps({
|
||||||
|
inDrafts: false,
|
||||||
|
inScheduledPosts: true,
|
||||||
|
unreadStatus: 10,
|
||||||
|
});
|
||||||
|
instance.updateTitle();
|
||||||
|
expect(document.title).toBe('(10) Scheduled - Test team display name');
|
||||||
|
|
||||||
|
wrapper.setProps({
|
||||||
|
inDrafts: true,
|
||||||
|
inScheduledPosts: false,
|
||||||
|
unreadStatus: 0,
|
||||||
|
});
|
||||||
|
instance.updateTitle();
|
||||||
|
expect(document.title).toBe('Drafts - Test team display name');
|
||||||
|
|
||||||
|
wrapper.setProps({
|
||||||
|
inDrafts: true,
|
||||||
|
inScheduledPosts: false,
|
||||||
|
unreadStatus: 10,
|
||||||
|
});
|
||||||
|
instance.updateTitle();
|
||||||
|
expect(document.title).toBe('(10) Drafts - Test team display name');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should set correct title on mentions on safari', () => {
|
test('should set correct title on mentions on safari', () => {
|
||||||
@ -149,4 +182,18 @@ describe('components/UnreadsStatusHandler', () => {
|
|||||||
|
|
||||||
expect(document.title).toBe('Drafts - Test team display name');
|
expect(document.title).toBe('Drafts - Test team display name');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should display correct title when in scheduled posts tab', () => {
|
||||||
|
const wrapper = shallowWithIntl(
|
||||||
|
<UnreadsStatusHandler
|
||||||
|
{...defaultProps}
|
||||||
|
inScheduledPosts={true}
|
||||||
|
currentChannel={undefined}
|
||||||
|
siteName={undefined}
|
||||||
|
/>,
|
||||||
|
) as unknown as ShallowWrapper<Props, any, UnreadsStatusHandlerClass>;
|
||||||
|
wrapper.instance().updateTitle();
|
||||||
|
|
||||||
|
expect(document.title).toBe('Scheduled - Test team display name');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -46,6 +46,7 @@ type Props = {
|
|||||||
currentTeammate: Channel | null;
|
currentTeammate: Channel | null;
|
||||||
inGlobalThreads: boolean;
|
inGlobalThreads: boolean;
|
||||||
inDrafts: boolean;
|
inDrafts: boolean;
|
||||||
|
inScheduledPosts: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class UnreadsStatusHandlerClass extends React.PureComponent<Props> {
|
export class UnreadsStatusHandlerClass extends React.PureComponent<Props> {
|
||||||
@ -90,6 +91,7 @@ export class UnreadsStatusHandlerClass extends React.PureComponent<Props> {
|
|||||||
unreadStatus,
|
unreadStatus,
|
||||||
inGlobalThreads,
|
inGlobalThreads,
|
||||||
inDrafts,
|
inDrafts,
|
||||||
|
inScheduledPosts,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const {formatMessage} = this.props.intl;
|
const {formatMessage} = this.props.intl;
|
||||||
|
|
||||||
@ -126,6 +128,15 @@ export class UnreadsStatusHandlerClass extends React.PureComponent<Props> {
|
|||||||
displayName: currentTeam.display_name,
|
displayName: currentTeam.display_name,
|
||||||
siteName: currentSiteName,
|
siteName: currentSiteName,
|
||||||
});
|
});
|
||||||
|
} else if (currentTeam && inScheduledPosts) {
|
||||||
|
document.title = formatMessage({
|
||||||
|
id: 'scheduledPosts.title',
|
||||||
|
defaultMessage: '{prefix}Scheduled - {displayName} {siteName}',
|
||||||
|
}, {
|
||||||
|
prefix: `${mentionTitle}${unreadTitle}`,
|
||||||
|
displayName: currentTeam.display_name,
|
||||||
|
siteName: currentSiteName,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
document.title = formatMessage({id: 'sidebar.team_select', defaultMessage: '{siteName} - Join a team'}, {siteName: currentSiteName || 'Mattermost'});
|
document.title = formatMessage({id: 'sidebar.team_select', defaultMessage: '{siteName} - Join a team'}, {siteName: currentSiteName || 'Mattermost'});
|
||||||
}
|
}
|
||||||
|
@ -4934,6 +4934,7 @@
|
|||||||
"scheduled_posts.row_title_channel.placeholder": "In: {icon} No Destination",
|
"scheduled_posts.row_title_channel.placeholder": "In: {icon} No Destination",
|
||||||
"scheduled_posts.row_title_thread.placeholder": "Thread to: {icon} No Destination",
|
"scheduled_posts.row_title_thread.placeholder": "Thread to: {icon} No Destination",
|
||||||
"scheduled_posts.row_title_thread.placeholder_tooltip": "The channel either doesn’t exist or you do not have access to it.",
|
"scheduled_posts.row_title_thread.placeholder_tooltip": "The channel either doesn’t exist or you do not have access to it.",
|
||||||
|
"scheduledPosts.title": "{prefix}Scheduled - {displayName} {siteName}",
|
||||||
"search_bar.channels": "Channels",
|
"search_bar.channels": "Channels",
|
||||||
"search_bar.clear": "Clear",
|
"search_bar.clear": "Clear",
|
||||||
"search_bar.file_types": "File types",
|
"search_bar.file_types": "File types",
|
||||||
|
Loading…
Reference in New Issue
Block a user