Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 05826cc6 authored by Simon Redman's avatar Simon Redman

Allow all-zero phone number

parent a5a0c16b
Pipeline #3896 passed with stage
in 7 minutes and 13 seconds
......@@ -285,5 +285,10 @@ QString ConversationListModel::canonicalizePhoneNumber(const QString& phoneNumbe
toReturn = toReturn.remove(')');
toReturn = toReturn.remove('+');
toReturn = toReturn.remove(QRegularExpression("^0*")); // Strip leading zeroes
if (toReturn.length() == 0) {
// If we have stripped away everything, assume this is a special number (and already canonicalized)
return phoneNumber;
return toReturn;
......@@ -47,6 +47,7 @@ private Q_SLOTS:
void testCzechRepublicShortCodeNonMatch();
void testDifferentPhoneNumbers1();
void testDifferentPhoneNumbers2();
void testAllZeros();
......@@ -242,5 +243,16 @@ void ConversationListModelTest::testDifferentPhoneNumbers2()
"Incorrectly *prefix* matched two phone numbers");
* Some places allow a message with all zeros to be a short code. We should allow that too.
void ConversationListModelTest::testAllZeros()
const QString& zeros = QLatin1String("00000");
const QString& canonicalized = ConversationListModel::canonicalizePhoneNumber(zeros);
QCOMPARE(canonicalized.length(), zeros.length());
#include "testconversationlistmodel.moc"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment