Ignore hashtags when sorting channels
This commit is contained in:
parent
fc937aaac8
commit
4694e66e98
4 changed files with 96 additions and 72 deletions
|
@ -3,14 +3,6 @@ import padStart from 'lodash/padStart';
|
|||
export { findBreakpoints, messageHeight } from './messageHeight';
|
||||
export { default as linkify } from './linkify';
|
||||
|
||||
export function normalizeChannel(channel) {
|
||||
if (channel.indexOf('#') !== 0) {
|
||||
return channel;
|
||||
}
|
||||
|
||||
return channel.split('#').join('').toLowerCase();
|
||||
}
|
||||
|
||||
export function isChannel(name) {
|
||||
// TODO: Handle other channel types
|
||||
if (typeof name === 'object') {
|
||||
|
@ -42,6 +34,22 @@ function isString(s, maxLength) {
|
|||
return true;
|
||||
}
|
||||
|
||||
export function trimPrefixChar(str, char) {
|
||||
if (!isString(str)) {
|
||||
return str;
|
||||
}
|
||||
|
||||
let start = 0;
|
||||
while (str[start] === char) {
|
||||
start++;
|
||||
}
|
||||
|
||||
if (start > 0) {
|
||||
return str.slice(start);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
// RFC 2812
|
||||
// nickname = ( letter / special ) *( letter / digit / special / "-" )
|
||||
// letter = A-Z / a-z
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue